PmDemandServiceImpl.java 236 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509
  1. package com.ozs.pm.service.impl;
  2. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  3. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  4. import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
  5. import com.baomidou.mybatisplus.core.metadata.IPage;
  6. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  7. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  8. import com.ozs.base.domain.BaseAgency;
  9. import com.ozs.base.domain.BaseExpert;
  10. import com.ozs.base.domain.BaseNotice;
  11. import com.ozs.base.domain.BaseNoticeType;
  12. import com.ozs.base.domain.BaseUnitInformation;
  13. import com.ozs.base.domain.vo.BaseExpertVo;
  14. import com.ozs.base.mapper.BaseExpertMapper;
  15. import com.ozs.base.service.BaseAgencyService;
  16. import com.ozs.base.service.BaseExpertService;
  17. import com.ozs.base.service.BaseNoticeService;
  18. import com.ozs.base.service.BaseNoticeTypeService;
  19. import com.ozs.common.constant.Constants;
  20. import com.ozs.common.core.domain.AjaxResult;
  21. import com.ozs.common.core.domain.entity.SysDept;
  22. import com.ozs.common.core.domain.entity.SysDictData;
  23. import com.ozs.common.core.domain.entity.SysUser;
  24. import com.ozs.common.enums.BidWinningStatus;
  25. import com.ozs.common.enums.ExpertType;
  26. import com.ozs.common.enums.IsExcess;
  27. import com.ozs.common.enums.NameListType;
  28. import com.ozs.common.enums.PlanPurchaseMode;
  29. import com.ozs.common.enums.PmProjectStatus;
  30. import com.ozs.common.enums.ProcurementMethodSuggest;
  31. import com.ozs.common.enums.ProjectAttribute;
  32. import com.ozs.common.enums.ProjectTypes;
  33. import com.ozs.common.enums.SysFileRefEnum;
  34. import com.ozs.common.enums.WarnStatus;
  35. import com.ozs.common.utils.DateUtils;
  36. import com.ozs.common.utils.RandomUtil;
  37. import com.ozs.common.utils.SecurityUtils;
  38. import com.ozs.common.utils.StringUtils;
  39. import com.ozs.common.utils.bean.BeanUtils;
  40. import com.ozs.home.domain.vo.HomeToDoQueryResVo;
  41. import com.ozs.plan.doman.ProvisionalPlan;
  42. import com.ozs.plan.doman.vo.responseVo.PlanQuarterResponseVo;
  43. import com.ozs.plan.mapper.ProvisionalPlanMapper;
  44. import com.ozs.plan.service.PlanYearsService;
  45. import com.ozs.pm.doman.PmAuditDeptRef;
  46. import com.ozs.pm.doman.PmBidFailure;
  47. import com.ozs.pm.doman.PmBidOpening;
  48. import com.ozs.pm.doman.PmBidWinning;
  49. import com.ozs.pm.doman.PmBidWinningOpeningRef;
  50. import com.ozs.pm.doman.PmBookBuilding;
  51. import com.ozs.pm.doman.PmCallQuestion;
  52. import com.ozs.pm.doman.PmContractInfo;
  53. import com.ozs.pm.doman.PmDemand;
  54. import com.ozs.pm.doman.PmDemandExpertRef;
  55. import com.ozs.pm.doman.PmExpertFeedback;
  56. import com.ozs.pm.doman.PmProcurementDocumentsReview;
  57. import com.ozs.pm.doman.PmProjectConstruction;
  58. import com.ozs.pm.doman.PmReleaseAnnouncement;
  59. import com.ozs.pm.doman.vo.requestVo.PmBaseExpertExtractReqVo;
  60. import com.ozs.pm.doman.vo.requestVo.PmBaseExpertFillReqVo;
  61. import com.ozs.pm.doman.vo.requestVo.PmBidFailureReqVo;
  62. import com.ozs.pm.doman.vo.requestVo.PmBidOpeningFillReqVo;
  63. import com.ozs.pm.doman.vo.requestVo.PmBidWinningReqVo;
  64. import com.ozs.pm.doman.vo.requestVo.PmBookBuildingReqVo;
  65. import com.ozs.pm.doman.vo.requestVo.PmContractInfoReqVo;
  66. import com.ozs.pm.doman.vo.requestVo.PmDemandReqVo;
  67. import com.ozs.pm.doman.vo.requestVo.PmProjectConstructionReqVo;
  68. import com.ozs.pm.doman.vo.requestVo.PmReleaseAnnouncementReqVo;
  69. import com.ozs.pm.doman.vo.responseVo.PmBaseExpertResVo;
  70. import com.ozs.pm.doman.vo.responseVo.PmBidFailureResVo;
  71. import com.ozs.pm.doman.vo.responseVo.PmBidOpeningResVo;
  72. import com.ozs.pm.doman.vo.responseVo.PmBidWinningResVo;
  73. import com.ozs.pm.doman.vo.responseVo.PmBookBuildingResVo;
  74. import com.ozs.pm.doman.vo.responseVo.PmCallQuestionResVo;
  75. import com.ozs.pm.doman.vo.responseVo.PmContractInfoResVo;
  76. import com.ozs.pm.doman.vo.responseVo.PmDemandResVo;
  77. import com.ozs.pm.doman.vo.responseVo.PmExpertFeedbackResVo;
  78. import com.ozs.pm.doman.vo.responseVo.PmProcurementDocumentsReviewResVo;
  79. import com.ozs.pm.doman.vo.responseVo.PmProjectConstructionResVo;
  80. import com.ozs.pm.doman.vo.responseVo.PmPurchaseExecutionResVo;
  81. import com.ozs.pm.doman.vo.responseVo.PmReleaseAnnouncementResVo;
  82. import com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo;
  83. import com.ozs.pm.mapper.PmDemandMapper;
  84. import com.ozs.pm.service.IPmDemandService;
  85. import com.ozs.pm.service.PmAuditDeptRefService;
  86. import com.ozs.pm.service.PmBidFailureService;
  87. import com.ozs.pm.service.PmBidOpeningService;
  88. import com.ozs.pm.service.PmBidWinningOpeningRefService;
  89. import com.ozs.pm.service.PmBidWinningService;
  90. import com.ozs.pm.service.PmBookBuildingService;
  91. import com.ozs.pm.service.PmCallQuestionHisService;
  92. import com.ozs.pm.service.PmCallQuestionService;
  93. import com.ozs.pm.service.PmContractInfoService;
  94. import com.ozs.pm.service.PmDemandExpertRefService;
  95. import com.ozs.pm.service.PmExpertFeedbackService;
  96. import com.ozs.pm.service.PmProcurementDocumentsReviewService;
  97. import com.ozs.pm.service.PmProjectConstructionService;
  98. import com.ozs.pm.service.PmReleaseAnnouncementService;
  99. import com.ozs.system.domain.SysFileInfo;
  100. import com.ozs.system.domain.SysFileRef;
  101. import com.ozs.system.domain.vo.SysRegionVO;
  102. import com.ozs.system.domain.vo.responseVo.SysDeptResponseVo;
  103. import com.ozs.system.mapper.SysDeptMapper;
  104. import com.ozs.system.mapper.SysFileRefMapper;
  105. import com.ozs.system.service.ISysDeptService;
  106. import com.ozs.system.service.ISysDictDataService;
  107. import com.ozs.system.service.ISysDictTypeService;
  108. import com.ozs.system.service.ISysRegionService;
  109. import com.ozs.system.service.ISysUserService;
  110. import com.ozs.system.service.SysFileRefService;
  111. import com.ozs.system.service.SysFileService;
  112. import lombok.extern.slf4j.Slf4j;
  113. import org.springframework.beans.factory.annotation.Autowired;
  114. import org.springframework.stereotype.Service;
  115. import org.springframework.transaction.annotation.Transactional;
  116. import org.springframework.util.ObjectUtils;
  117. import java.math.BigDecimal;
  118. import java.text.DecimalFormat;
  119. import java.text.ParseException;
  120. import java.util.ArrayList;
  121. import java.util.Arrays;
  122. import java.util.Calendar;
  123. import java.util.Date;
  124. import java.util.HashMap;
  125. import java.util.Iterator;
  126. import java.util.LinkedHashMap;
  127. import java.util.LinkedList;
  128. import java.util.List;
  129. import java.util.Map;
  130. import java.util.stream.Collectors;
  131. /**
  132. * 采购需求Service业务层处理
  133. *
  134. * @author ruoyi
  135. * @date 2023-01-16
  136. */
  137. @Service
  138. @Slf4j
  139. public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> implements IPmDemandService {
  140. @Autowired
  141. private PmDemandMapper pmDemandMapper;
  142. @Autowired
  143. private ISysDeptService deptService;
  144. @Autowired
  145. private ISysDictDataService dictDataService;
  146. @Autowired
  147. private ISysDictTypeService dictTypeService;
  148. @Autowired
  149. private SysFileService fileService;
  150. @Autowired
  151. private SysFileRefService sysFileRefService;
  152. @Autowired
  153. private PmReleaseAnnouncementService pmReleaseAnnouncementService;
  154. @Autowired
  155. private BaseExpertService baseExpertService;
  156. @Autowired
  157. private PmDemandExpertRefService pmDemandExpertRefService;
  158. @Autowired
  159. private PmBidOpeningService pmBidOpeningService;
  160. @Autowired
  161. private SysFileRefMapper sysFileRefMapper;
  162. @Autowired
  163. private PmBookBuildingService pmBookBuildingService;
  164. @Autowired
  165. private PmCallQuestionService pmCallQuestionService;
  166. @Autowired
  167. private PmBidWinningService pmBidWinningService;
  168. @Autowired
  169. private ISysDictTypeService iSysDictTypeService;
  170. @Autowired
  171. private PmBidFailureService pmBidFailureService;
  172. @Autowired
  173. private PmBidWinningOpeningRefService pmBidWinningOpeningRefService;
  174. @Autowired
  175. private PmContractInfoService pmContractInfoService;
  176. @Autowired
  177. private BaseAgencyService baseAgencyService;
  178. @Autowired
  179. private PmProjectConstructionService pmProjectConstructionService;
  180. @Autowired
  181. private BaseNoticeTypeService baseNoticeTypeService;
  182. @Autowired
  183. private BaseNoticeService baseNoticeService;
  184. @Autowired
  185. private PlanYearsService planYearsService;
  186. @Autowired
  187. private ISysRegionService iSysRegionService;
  188. @Autowired
  189. private ISysUserService userService;
  190. @Autowired
  191. private SysDeptMapper deptMapper;
  192. @Autowired
  193. private BaseExpertMapper baseExpertMapper;
  194. @Autowired
  195. private PmAuditDeptRefService pmAuditDeptRefService;
  196. @Autowired
  197. private ProvisionalPlanMapper provisionalPlanMapper;
  198. @Autowired
  199. private PmExpertFeedbackService pmExpertFeedbackService;
  200. @Autowired
  201. private PmProcurementDocumentsReviewService pmProcurementDocumentsReviewService;
  202. @Autowired
  203. private PmCallQuestionHisService questionHisService;
  204. /**
  205. * 查询采购需求
  206. *
  207. * @param demandId 采购需求主键
  208. * @return 采购需求
  209. */
  210. @Override
  211. public PmDemandResVo selectPmDemandByDemandId(Long demandId, String detailType) {
  212. PmDemand pmDemand = this.getById(demandId);
  213. if (pmDemand != null) {
  214. PmDemandResVo vo = new PmDemandResVo();
  215. vo.setProjectName(pmDemand.getProjectName());
  216. vo.setDemandId(demandId);
  217. if ("1".equals(detailType)) { //项目计划
  218. BeanUtils.copyProperties(pmDemand, vo);
  219. //project_type,evaluation 从原来计划里取
  220. ProvisionalPlan provisionalPlan = provisionalPlanMapper.seletById(pmDemand.getPlanId());
  221. if (provisionalPlan != null) {
  222. vo.setProjectType(provisionalPlan.getProjectType());
  223. vo.setEvaluation(provisionalPlan.getEvaluation().doubleValue());
  224. }
  225. SysDeptResponseVo sysDeptResponseVo = (SysDeptResponseVo) deptService.selectDeptById(vo.getPurchaseDeptId()).get("sysDept");
  226. if (sysDeptResponseVo != null) {
  227. vo.setPurchaseDeptName(sysDeptResponseVo.getDeptName());
  228. }
  229. String purchaseServicesName = dictDataService.selectDictLabel("purchase_services", vo.getPurchaseServices());
  230. if (StringUtils.isNotEmpty(purchaseServicesName)) {
  231. vo.setPurchaseServicesName(purchaseServicesName);
  232. }
  233. //采购需求附件
  234. List<SysFileInfo> demandFileInfos = getSysFileInfoList(vo.getDemandId(), SysFileRefEnum.PM_DEMAND.getType());
  235. if (!ObjectUtils.isEmpty(demandFileInfos)) {
  236. vo.setDemandFileInfos(demandFileInfos);
  237. }
  238. //项目类型
  239. String projectTypeName = dictDataService.selectDictLabel("sys_project_type", vo.getProjectType());
  240. if (StringUtils.isNotEmpty(projectTypeName)) {
  241. vo.setProjectTypeName(projectTypeName);
  242. }
  243. //是否为超限额计划
  244. for (IsExcess value : IsExcess.values()) {
  245. if (vo.getIsExcess() != null && vo.getIsExcess().equals(value.getCode())) {
  246. vo.setIsExcessName(value.getInfo());
  247. break;
  248. }
  249. }
  250. //采购方式
  251. for (PlanPurchaseMode value : PlanPurchaseMode.values()) {
  252. if (vo.getPurchaseMode() != null && vo.getPurchaseMode().equals(value.getCode())) {
  253. vo.setPurchaseModeName(value.getInfo());
  254. break;
  255. }
  256. }
  257. //项目属性
  258. for (ProjectAttribute value : ProjectAttribute.values()) {
  259. if (vo.getProjectAttr() != null && vo.getProjectAttr().equals(value.getCode())) {
  260. vo.setProjectAttrName(value.getInfo());
  261. break;
  262. }
  263. }
  264. //预警状态
  265. for (WarnStatus value : WarnStatus.values()) {
  266. if (vo.getWarnStatus() != null && vo.getWarnStatus().equals(value.getCode())) {
  267. vo.setWarnStatusName(value.getInfo());
  268. break;
  269. }
  270. }
  271. //项目状态
  272. for (PmProjectStatus value : PmProjectStatus.values()) {
  273. if (vo.getProjectStatus() != null && vo.getProjectStatus().equals(value.getCode())) {
  274. vo.setProjectStatusName(value.getInfo());
  275. break;
  276. }
  277. }
  278. } else if ("2".equals(detailType)) { //需求建档
  279. //采购需求审核文件
  280. List<SysFileInfo> auditFileInfos = getSysFileInfoList(vo.getDemandId(), SysFileRefEnum.PM_DEMAND_EXAMINE.getType());
  281. if (!ObjectUtils.isEmpty(auditFileInfos)) {
  282. vo.setAuditFileInfos(auditFileInfos);
  283. }
  284. LambdaQueryWrapper<PmBookBuilding> lambdaQueryWrapper = new LambdaQueryWrapper<>();
  285. lambdaQueryWrapper.eq(PmBookBuilding::getDemandId, demandId);
  286. PmBookBuilding pmBookBuilding = pmBookBuildingService.getOne(lambdaQueryWrapper);
  287. if (pmBookBuilding != null) {
  288. PmBookBuildingResVo responseVo = new PmBookBuildingResVo();
  289. BeanUtils.copyProperties(pmBookBuilding, responseVo);
  290. List<SysFileInfo> fileInfos = getSysFileInfoList(pmBookBuilding.getId(), SysFileRefEnum.PM_BOOK_BUILDING.getType());
  291. if (!ObjectUtils.isEmpty(fileInfos)) {
  292. if (!ObjectUtils.isEmpty(auditFileInfos)) {
  293. fileInfos.addAll(auditFileInfos);
  294. }
  295. responseVo.setFileInfos(fileInfos);
  296. }
  297. vo.setPmBookBuildingResVo(responseVo);
  298. }
  299. } else if ("3".equals(detailType)) { //任务下达
  300. vo.setTaskReleaseTime(pmDemand.getTaskReleaseTime());
  301. //任务下达文件
  302. List<SysFileInfo> taskReleaseFileInfos = getSysFileInfoList(vo.getDemandId(), SysFileRefEnum.PM_TAST_RELEASE.getType());
  303. if (!ObjectUtils.isEmpty(taskReleaseFileInfos)) {
  304. vo.setTaskReleaseFileInfos(taskReleaseFileInfos);
  305. }
  306. } else if ("4".equals(detailType)) { //中标信息
  307. setPmPurchaseExecutionResVo(vo, pmDemand);
  308. } else if ("5".equals(detailType)) { //合同信息
  309. setPmPurchaseExecutionResVo(vo, pmDemand);
  310. LambdaQueryWrapper<PmContractInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
  311. lambdaQueryWrapper.eq(PmContractInfo::getDemandId, demandId);
  312. PmContractInfo pmContractInfo = pmContractInfoService.getOne(lambdaQueryWrapper);
  313. if (pmContractInfo != null) {
  314. PmContractInfoResVo pmContractInfoResVo = new PmContractInfoResVo();
  315. BeanUtils.copyProperties(pmContractInfo, pmContractInfoResVo);
  316. //合同信息文件
  317. List<SysFileInfo> fileInfos = getSysFileInfoList(pmContractInfo.getId(), SysFileRefEnum.PM_CONTRACT_INFO.getType());
  318. if (!ObjectUtils.isEmpty(fileInfos)) {
  319. pmContractInfoResVo.setFileInfos(fileInfos);
  320. }
  321. vo.setPmContractInfoResVo(pmContractInfoResVo);
  322. }
  323. } else if ("6".equals(detailType)) { //建设情况
  324. LambdaQueryWrapper<PmProjectConstruction> lambdaQueryWrapper = new LambdaQueryWrapper<>();
  325. lambdaQueryWrapper.eq(PmProjectConstruction::getDemandId, demandId);
  326. PmProjectConstruction pmProjectConstruction = pmProjectConstructionService.getOne(lambdaQueryWrapper);
  327. if (pmProjectConstruction != null) {
  328. PmProjectConstructionResVo pmProjectConstructionResVo = new PmProjectConstructionResVo();
  329. BeanUtils.copyProperties(pmProjectConstruction, pmProjectConstructionResVo);
  330. //建设情况文件
  331. List<SysFileInfo> fileInfos = getSysFileInfoList(pmProjectConstruction.getId(), SysFileRefEnum.PM_PROJECT_CONSTRUCTION.getType());
  332. if (!ObjectUtils.isEmpty(fileInfos)) {
  333. pmProjectConstructionResVo.setFileInfos(fileInfos);
  334. }
  335. vo.setPmProjectConstructionResVo(pmProjectConstructionResVo);
  336. }
  337. }
  338. return vo;
  339. } else {
  340. return null;
  341. }
  342. }
  343. private void setPmPurchaseExecutionResVo(PmDemandResVo vo, PmDemand pmDemand) {
  344. Long demandId = pmDemand.getDemandId();
  345. PmPurchaseExecutionResVo pmPurchaseExecutionResVo = new PmPurchaseExecutionResVo();
  346. //代理商信息
  347. BaseAgency baseAgency = this.baseAgencyService.getById(pmDemand.getAgencyId());
  348. List<SysDictData> dictData = dictTypeService.selectDictDataByType(Constants.SYS_COMPANY_NATURE);
  349. for (SysDictData data : dictData) {
  350. if (data.getDictValue().equals(baseAgency.getCompanyNature())) {
  351. baseAgency.setCompanyNatureName(data.getDictLabel());
  352. break;
  353. }
  354. }
  355. List<SysDictData> dictDataT = dictTypeService.selectDictDataByType(Constants.SYS_PROJECT_TYPE);
  356. for (SysDictData data : dictDataT) {
  357. if (data.getDictValue().equals(baseAgency.getCompanyType() + "")) {
  358. baseAgency.setCompanyTypeName(data.getDictLabel());
  359. break;
  360. }
  361. }
  362. pmPurchaseExecutionResVo.setBaseAgency(baseAgency);
  363. vo.setPurchaseTaskDocumentNumber(pmDemand.getPurchaseTaskDocumentNumber());
  364. //专家意见反馈
  365. LambdaQueryWrapper<PmExpertFeedback> pmExpertFeedbackLambdaQueryWrapper = new LambdaQueryWrapper<>();
  366. pmExpertFeedbackLambdaQueryWrapper.eq(PmExpertFeedback::getDemandId, demandId);
  367. PmExpertFeedback pmExpertFeedback = pmExpertFeedbackService.getOne(pmExpertFeedbackLambdaQueryWrapper);
  368. if (!ObjectUtils.isEmpty(pmExpertFeedback)) {
  369. PmExpertFeedbackResVo pmExpertFeedbackResVo = new PmExpertFeedbackResVo();
  370. BeanUtils.copyProperties(pmExpertFeedback, pmExpertFeedbackResVo);
  371. List<SysFileInfo> fileInfos = getSysFileInfoList(pmExpertFeedbackResVo.getId(), SysFileRefEnum.PM_EXPERT_FEEDBACK.getType());
  372. if (!ObjectUtils.isEmpty(fileInfos)) {
  373. pmExpertFeedbackResVo.setFileInfos(fileInfos);
  374. }
  375. pmPurchaseExecutionResVo.setPmExpertFeedbackResVo(pmExpertFeedbackResVo);
  376. }
  377. //采购文件编制审核
  378. LambdaQueryWrapper<PmProcurementDocumentsReview> pmProcurementDocumentsReviewLambdaQueryWrapper = new LambdaQueryWrapper<>();
  379. pmProcurementDocumentsReviewLambdaQueryWrapper.eq(PmProcurementDocumentsReview::getDemandId, demandId);
  380. PmProcurementDocumentsReview pmProcurementDocumentsReview = pmProcurementDocumentsReviewService.getOne(pmProcurementDocumentsReviewLambdaQueryWrapper);
  381. if (!ObjectUtils.isEmpty(pmProcurementDocumentsReview)) {
  382. PmProcurementDocumentsReviewResVo pmProcurementDocumentsReviewResVo = new PmProcurementDocumentsReviewResVo();
  383. BeanUtils.copyProperties(pmProcurementDocumentsReview, pmProcurementDocumentsReviewResVo);
  384. List<SysFileInfo> fileInfos = getSysFileInfoList(pmProcurementDocumentsReviewResVo.getId(), SysFileRefEnum.PM_BID_FILE.getType());
  385. if (!ObjectUtils.isEmpty(fileInfos)) {
  386. pmProcurementDocumentsReviewResVo.setFileInfos(fileInfos);
  387. }
  388. pmPurchaseExecutionResVo.setPmProcurementDocumentsReviewResVo(pmProcurementDocumentsReviewResVo);
  389. }
  390. //采购公告列表
  391. LambdaQueryWrapper<PmReleaseAnnouncement> lambdaQueryWrapper = new LambdaQueryWrapper<>();
  392. lambdaQueryWrapper.eq(PmReleaseAnnouncement::getDemandId, demandId).orderByDesc(PmReleaseAnnouncement::getReleaseTime);
  393. List<PmReleaseAnnouncement> pmReleaseAnnouncementList = this.pmReleaseAnnouncementService.list(lambdaQueryWrapper);
  394. if (!ObjectUtils.isEmpty(pmReleaseAnnouncementList)) {
  395. List<PmReleaseAnnouncementResVo> pmReleaseAnnouncementResVoList = new ArrayList<>();
  396. List<SysFileInfo> fileInfosAll = new ArrayList<>();
  397. for (PmReleaseAnnouncement pmReleaseAnnouncement : pmReleaseAnnouncementList) {
  398. PmReleaseAnnouncementResVo pmReleaseAnnouncementResVo = new PmReleaseAnnouncementResVo();
  399. BeanUtils.copyProperties(pmReleaseAnnouncement, pmReleaseAnnouncementResVo);
  400. List<SysFileInfo> fileInfos = getSysFileInfoList(pmReleaseAnnouncementResVo.getId(), SysFileRefEnum.PM_ANNOUNCEMENT_FILE.getType());
  401. if (!ObjectUtils.isEmpty(fileInfos)) {
  402. fileInfosAll.addAll(fileInfos);
  403. }
  404. pmReleaseAnnouncementResVoList.add(pmReleaseAnnouncementResVo);
  405. }
  406. pmPurchaseExecutionResVo.setPmReleaseAnnouncementFileInfos(fileInfosAll);
  407. pmPurchaseExecutionResVo.setPmReleaseAnnouncementResVoList(pmReleaseAnnouncementResVoList);
  408. }
  409. //标前质疑投诉
  410. LambdaQueryWrapper<PmCallQuestion> pmCallQuestionLambdaQueryWrapper = new LambdaQueryWrapper<>();
  411. pmCallQuestionLambdaQueryWrapper.eq(PmCallQuestion::getDemandId, demandId)
  412. .eq(PmCallQuestion::getType, '0').orderByDesc(PmCallQuestion::getCallQuestionTime);
  413. List<PmCallQuestion> pmCallQuestionList = pmCallQuestionService.list(pmCallQuestionLambdaQueryWrapper);
  414. if (!ObjectUtils.isEmpty(pmCallQuestionList)) {
  415. List<PmCallQuestionResVo> pmCallQuestionResVoList = new ArrayList<>();
  416. List<SysFileInfo> fileInfosAll = new ArrayList<>();
  417. for (PmCallQuestion pmCallQuestion : pmCallQuestionList) {
  418. PmCallQuestionResVo pmCallQuestionResVo = new PmCallQuestionResVo();
  419. BeanUtils.copyProperties(pmCallQuestion, pmCallQuestionResVo);
  420. List<SysFileInfo> fileInfos = getSysFileInfoList(pmCallQuestionResVo.getId(), SysFileRefEnum.PM_PRE_BID_CALL_QUESTION.getType());
  421. if (!ObjectUtils.isEmpty(fileInfos)) {
  422. fileInfosAll.addAll(fileInfos);
  423. }
  424. pmCallQuestionResVoList.add(pmCallQuestionResVo);
  425. }
  426. pmPurchaseExecutionResVo.setPmCallQuestionPreResVoList(pmCallQuestionResVoList);
  427. pmPurchaseExecutionResVo.setPmCallQuestionPreFileInfos(fileInfosAll);
  428. }
  429. //专家信息列表
  430. List<PmBaseExpertResVo> pmBaseExpertResVoList = this.pmDemandExpertRefService.getPmBaseExpertResVoList(demandId);
  431. pmPurchaseExecutionResVo.setPmBaseExpertResVoList(pmBaseExpertResVoList);
  432. //开标信息列表
  433. List<PmBidOpeningResVo> pmBidOpeningResVoList = this.pmBidOpeningService.getPmBidOpeningResVoList(demandId);
  434. pmPurchaseExecutionResVo.setPmBidOpeningResVoList(pmBidOpeningResVoList);
  435. //评标结果公告列表
  436. LambdaQueryWrapper<PmBidWinning> lambdaQueryWrapper1 = new LambdaQueryWrapper<>();
  437. lambdaQueryWrapper1.eq(PmBidWinning::getDemandId, demandId)
  438. .ne(PmBidWinning::getStatus, BidWinningStatus.BE_REPLACED.getCode()).orderByDesc(PmBidWinning::getBidAnnouncementTime);
  439. List<PmBidWinning> pmBidWinningList = this.pmBidWinningService.list(lambdaQueryWrapper1);
  440. if (!ObjectUtils.isEmpty(pmBidWinningList)) {
  441. List<PmBidWinningResVo> pmBidWinningResVoList = new ArrayList<>();
  442. List<SysFileInfo> fileInfosAll = new ArrayList<>();
  443. for (PmBidWinning pmBidWinning : pmBidWinningList) {
  444. PmBidWinningResVo pmBidWinningResVo = new PmBidWinningResVo();
  445. BeanUtils.copyProperties(pmBidWinning, pmBidWinningResVo);
  446. pmBidWinningResVoList.add(pmBidWinningResVo);
  447. List<SysFileInfo> fileInfos = getSysFileInfoList(pmBidWinningResVo.getId(), SysFileRefEnum.PM_BID_WINNING_FILE.getType());
  448. if (!ObjectUtils.isEmpty(fileInfos)) {
  449. fileInfosAll.addAll(fileInfos);
  450. }
  451. }
  452. pmPurchaseExecutionResVo.setPmBidWinningResVoList(pmBidWinningResVoList);
  453. pmPurchaseExecutionResVo.setPmBidWinningFileInfos(fileInfosAll);
  454. }
  455. //标后质疑
  456. LambdaQueryWrapper<PmCallQuestion> pmCallQuestionLambdaQueryWrapper2 = new LambdaQueryWrapper<>();
  457. pmCallQuestionLambdaQueryWrapper2.eq(PmCallQuestion::getDemandId, demandId)
  458. .eq(PmCallQuestion::getType, '1').orderByDesc(PmCallQuestion::getCallQuestionTime);
  459. List<PmCallQuestion> pmCallQuestionList2 = pmCallQuestionService.list(pmCallQuestionLambdaQueryWrapper2);
  460. if (!ObjectUtils.isEmpty(pmCallQuestionList2)) {
  461. List<PmCallQuestionResVo> pmCallQuestionResVoList = new ArrayList<>();
  462. List<SysFileInfo> fileInfosAll = new ArrayList<>();
  463. for (PmCallQuestion pmCallQuestion : pmCallQuestionList2) {
  464. PmCallQuestionResVo pmCallQuestionResVo = new PmCallQuestionResVo();
  465. BeanUtils.copyProperties(pmCallQuestion, pmCallQuestionResVo);
  466. List<SysFileInfo> fileInfos = getSysFileInfoList(pmCallQuestionResVo.getId(), SysFileRefEnum.PM_BID_CALL_QEUSTION_FILE.getType());
  467. if (!ObjectUtils.isEmpty(fileInfos)) {
  468. fileInfosAll.addAll(fileInfos);
  469. }
  470. pmCallQuestionResVoList.add(pmCallQuestionResVo);
  471. }
  472. pmPurchaseExecutionResVo.setPmCallQuestionPostResVoList(pmCallQuestionResVoList);
  473. pmPurchaseExecutionResVo.setPmCallRequestPostFileInfos(fileInfosAll);
  474. }
  475. //流标情况
  476. LambdaQueryWrapper<PmBidFailure> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
  477. lambdaQueryWrapper2.eq(PmBidFailure::getDemandId, demandId).orderByDesc(PmBidFailure::getBidFailureTime);
  478. List<PmBidFailure> pmBidFailureList = this.pmBidFailureService.list(lambdaQueryWrapper2);
  479. if (!ObjectUtils.isEmpty(pmBidFailureList)) {
  480. List<PmBidFailureResVo> pmBidFailureResVoList = new ArrayList<>();
  481. List<PmCallQuestionResVo> pmCallQuestionBidFailureResVoList = new ArrayList<>();
  482. List<SysFileInfo> pmBidFailureFileInfos = new ArrayList<>();
  483. List<SysFileInfo> pmCallRequestBidFailureFileInfos = new ArrayList<>();
  484. for (PmBidFailure pmBidFailure : pmBidFailureList) {
  485. PmBidFailureResVo pmBidFailureResVo = new PmBidFailureResVo();
  486. BeanUtils.copyProperties(pmBidFailure, pmBidFailureResVo);
  487. pmBidFailureResVoList.add(pmBidFailureResVo);
  488. //流标文件
  489. List<SysFileInfo> fileInfos = getSysFileInfoList(pmBidFailure.getId(), SysFileRefEnum.PM_BID_FAILURE_FILE.getType());
  490. if (!ObjectUtils.isEmpty(fileInfos)) {
  491. pmBidFailureFileInfos.addAll(fileInfos);
  492. }
  493. if ("1".equals(pmBidFailure.getCallQuestion())) { //有质疑
  494. PmCallQuestionResVo pmCallQuestionResVo = new PmCallQuestionResVo();
  495. pmCallQuestionResVo.setCallQuestion(pmBidFailure.getCallQuestion());
  496. pmCallQuestionResVo.setCallQuestionTime(pmBidFailure.getCallQuestionTime());
  497. pmCallQuestionBidFailureResVoList.add(pmCallQuestionResVo);
  498. //流废标质疑文件
  499. List<SysFileInfo> fileInfos2 = getSysFileInfoList(pmBidFailure.getId(), SysFileRefEnum.PM_BID_FAILURE_CALL_QUESTION.getType());
  500. if (!ObjectUtils.isEmpty(fileInfos2)) {
  501. pmCallRequestBidFailureFileInfos.addAll(fileInfos2);
  502. }
  503. }
  504. }
  505. pmPurchaseExecutionResVo.setPmBidFailureResVoList(pmBidFailureResVoList);
  506. pmPurchaseExecutionResVo.setPmBidFailureFileInfos(pmBidFailureFileInfos);
  507. //流废标处置
  508. pmPurchaseExecutionResVo.setPmCallQuestionBidFailureResVoList(pmCallQuestionBidFailureResVoList);
  509. pmPurchaseExecutionResVo.setPmCallRequestBidFailureFileInfos(pmCallRequestBidFailureFileInfos);
  510. }
  511. //中标通知书
  512. List<SysFileInfo> pmBidWinningNotificationFileInfos = getSysFileInfoList(vo.getDemandId(), SysFileRefEnum.PM_BID_WINNING_NOTIFICATION.getType());
  513. pmPurchaseExecutionResVo.setFileInfos(pmBidWinningNotificationFileInfos);
  514. vo.setUpAcceptanceTime(pmDemand.getUpAcceptanceTime());
  515. vo.setPmPurchaseExecutionResVo(pmPurchaseExecutionResVo);
  516. }
  517. /**
  518. * 查询采购需求列表
  519. *
  520. * @param pmDemandReqVo
  521. * @return 采购需求
  522. */
  523. @Override
  524. public IPage<PmDemandResVo> selectPmDemandList(PmDemandReqVo pmDemandReqVo, int reqType) {
  525. LambdaQueryWrapper<PmDemand> lw = new LambdaQueryWrapper<>();
  526. SysUser sysUser = userService.selectUserById(SecurityUtils.getUserId());
  527. List<PmAuditDeptRef> list = new ArrayList<>();
  528. LambdaQueryWrapper<PmAuditDeptRef> l = new LambdaQueryWrapper<>();
  529. l.eq(PmAuditDeptRef::getDeptId, SecurityUtils.getDeptId());
  530. l.eq(PmAuditDeptRef::getRefType, "2");
  531. list = pmAuditDeptRefService.list(l);
  532. if (!pmDemandReqVo.getIsAdmin()) {
  533. if (Arrays.asList(1, 2).contains(reqType)) {
  534. if (!ObjectUtils.isEmpty(list)) {
  535. lw.in(PmDemand::getDemandId, list.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toList()));
  536. }
  537. //采购执行管理中,本单位超额项目交给上级处理,本单位不处理。
  538. } else if (3 == reqType) {
  539. if (!ObjectUtils.isEmpty(list)) {
  540. //查出审核此项目的单位
  541. List<Long> longList = list.stream().map(PmAuditDeptRef::getDeptId).collect(Collectors.toList());
  542. // 如果有上级单位存在,将本单位剔除
  543. SysDept sysDept = deptMapper.selectDeptById(sysUser.getDeptId());
  544. //本单位所有参与审核的项目id
  545. List<Long> refList = list.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toList());
  546. //替身,取交集用
  547. List<Long> refListL = refList;
  548. //上级参与审核的项目
  549. List<Long> refListf = new ArrayList<>();
  550. LambdaQueryWrapper<PmDemand> lwf = new LambdaQueryWrapper<PmDemand>();
  551. List<PmAuditDeptRef> listf = new ArrayList<>();
  552. if (sysDept.getParentId() != 0) {
  553. LambdaQueryWrapper<PmAuditDeptRef> lf = new LambdaQueryWrapper<>();
  554. lf.eq(PmAuditDeptRef::getDeptId, sysDept.getParentId());
  555. lf.eq(PmAuditDeptRef::getRefType, "2");
  556. listf = pmAuditDeptRefService.list(lf);
  557. //上级参与审核的项目id
  558. refListf = listf.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toList());
  559. }
  560. //取集合交集,交集中的是上级处理,本单位不处理
  561. if (!ObjectUtils.isEmpty(refListf)) {
  562. refListL.retainAll(refListf);
  563. Iterator<Long> it = refList.iterator();
  564. while (it.hasNext()) {
  565. //只留下本单位要处理的项目
  566. if (refListL.contains(it.next())) {
  567. it.remove();
  568. }
  569. }
  570. }
  571. //为空就返回空
  572. if (ObjectUtils.isEmpty(refList) && !SysUser.isAdmin(SecurityUtils.getUserId())) {
  573. lw.in(PmDemand::getDemandId, -1);
  574. } else if (!ObjectUtils.isEmpty(refList) && !SysUser.isAdmin(SecurityUtils.getUserId())) {
  575. lw.in(PmDemand::getDemandId, refList);
  576. }
  577. }
  578. } else {
  579. lw.eq(PmDemand::getPurchaseDeptId, SecurityUtils.getDeptId());
  580. }
  581. }
  582. if (!StringUtils.isBlank(pmDemandReqVo.getProjectName())) {
  583. lw.like(PmDemand::getProjectName, "%" + pmDemandReqVo.getProjectName() + "%");
  584. }
  585. if (!StringUtils.isBlank(pmDemandReqVo.getPurchaseServices())) {
  586. lw.eq(PmDemand::getPurchaseServices, pmDemandReqVo.getPurchaseServices());
  587. }
  588. if (!ObjectUtils.isEmpty(pmDemandReqVo.getProjectStatus())) {
  589. lw.eq(PmDemand::getProjectStatus, pmDemandReqVo.getProjectStatus());
  590. }
  591. if (!ObjectUtils.isEmpty(pmDemandReqVo.getWarnStatus())) {
  592. lw.eq(PmDemand::getWarnStatus, pmDemandReqVo.getWarnStatus());
  593. }
  594. if (!ObjectUtils.isEmpty(pmDemandReqVo.getIsExcess())) {
  595. lw.eq(PmDemand::getIsExcess, pmDemandReqVo.getIsExcess());
  596. }
  597. if (!StringUtils.isBlank(pmDemandReqVo.getBeginDate())) {
  598. lw.apply("(plan_demand_sub_time >= '" + pmDemandReqVo.getBeginDate() + "' or plan_purchase_finish_time >= '" + pmDemandReqVo.getBeginDate() + "' or plan_deliver_time >= '" + pmDemandReqVo.getBeginDate() + "' )");
  599. }
  600. if (!StringUtils.isBlank(pmDemandReqVo.getEndDate())) {
  601. lw.apply("(plan_demand_sub_time <= '" + pmDemandReqVo.getEndDate() + "' or plan_purchase_finish_time <= '" + pmDemandReqVo.getEndDate() + "' or plan_deliver_time <= '" + pmDemandReqVo.getEndDate() + "' )");
  602. }
  603. if (reqType == 1) { //需求审核单位列表
  604. lw.apply("(project_status >=6 )");
  605. } else if (reqType == 2) { //任务下达列表
  606. lw.apply("(project_status >=8 )");
  607. } else if (reqType == 3) { //采购执行列表
  608. lw.apply("(project_status >=9 )");
  609. } else if (reqType == 4) { //合同信息列表
  610. lw.apply("(project_status >=19 )");
  611. } else if (reqType == 5) { //项目建设列表
  612. lw.apply("(project_status >=20 )");
  613. }
  614. lw.last(" order by project_status, plan_demand_sub_time");
  615. IPage<PmDemand> pageRes = this.page(new Page<>(pmDemandReqVo.getPageNum(), pmDemandReqVo.getPageSize()), lw);
  616. IPage<PmDemandResVo> results = new Page<>(pageRes.getCurrent(), pageRes.getSize(), pageRes.getTotal());
  617. if (pageRes.getRecords() != null && pageRes.getRecords().size() > 0) {
  618. List<PmDemandResVo> pmDemandResVos = demandChangeTo(pageRes.getRecords());
  619. for (PmDemandResVo vo : pmDemandResVos) {
  620. if (Arrays.asList(1, 2, 3).contains(reqType)) {
  621. // 根据项目id 和 部门id 和 参数类型 获取 部门级别
  622. List<PmAuditDeptRef> collect = list.stream()
  623. .filter(o -> o.getRefId().equals(vo.getDemandId()))
  624. .collect(Collectors.toList());
  625. if (!ObjectUtils.isEmpty(collect)) {
  626. String deptLevel = collect.get(0).getDeptLevel();
  627. // 根据项目id 和 参数类型 获取 所有审核数据
  628. LambdaQueryWrapper<PmAuditDeptRef> ll = new LambdaQueryWrapper<>();
  629. ll.eq(PmAuditDeptRef::getRefId, vo.getDemandId());
  630. ll.eq(PmAuditDeptRef::getRefType, "2");
  631. List<PmAuditDeptRef> listl = pmAuditDeptRefService.list(l);
  632. // 判断当前用户是否有审核权限
  633. boolean flay = true;
  634. List<PmAuditDeptRef> collect1 = listl.stream()
  635. .filter(pmAuditDeptRef -> pmAuditDeptRef.getRefId().equals(vo.getDemandId()))
  636. .collect(Collectors.toList());
  637. for (PmAuditDeptRef pmAuditDeptRef : collect1) {
  638. if (pmAuditDeptRef.getDeptLevel().compareTo(deptLevel) > 0
  639. && pmAuditDeptRef.getStatus().equals(Integer.parseInt("0"))) {
  640. flay = false;
  641. } else if (pmAuditDeptRef.getDeptLevel().compareTo(deptLevel) == 0
  642. && pmAuditDeptRef.getStatus().equals(Integer.parseInt("1"))) {
  643. flay = false;
  644. }
  645. }
  646. vo.setFlay(flay);
  647. }
  648. }
  649. LambdaQueryWrapper<PmExpertFeedback> pmExpertFeedbackLambdaQueryWrapper = new LambdaQueryWrapper<>();
  650. pmExpertFeedbackLambdaQueryWrapper.eq(PmExpertFeedback::getDemandId, vo.getDemandId());
  651. PmExpertFeedback pmExpertFeedback = this.pmExpertFeedbackService.getOne(pmExpertFeedbackLambdaQueryWrapper);
  652. if (pmExpertFeedback != null) {
  653. vo.setProjectNumber(pmExpertFeedback.getProjectNumber());
  654. vo.setDocumentReviewTime(pmExpertFeedback.getDocumentReviewTime());
  655. }
  656. LambdaQueryWrapper<PmProcurementDocumentsReview> pmProcurementDocumentsReviewLambdaQueryWrapper = new LambdaQueryWrapper<>();
  657. pmProcurementDocumentsReviewLambdaQueryWrapper.eq(PmProcurementDocumentsReview::getDemandId, vo.getDemandId());
  658. PmProcurementDocumentsReview pmProcurementDocumentsReview = this.pmProcurementDocumentsReviewService.getOne(pmProcurementDocumentsReviewLambdaQueryWrapper);
  659. if (pmProcurementDocumentsReview != null) {
  660. vo.setProcurementOfficeApprovalTime(pmProcurementDocumentsReview.getProcurementOfficeApprovalTime());
  661. }
  662. if (Integer.parseInt(vo.getProjectStatus()) > 12 && Integer.parseInt(vo.getProjectStatus()) != 18) {
  663. LambdaQueryWrapper<PmReleaseAnnouncement> pmReleaseAnnouncementLambdaQueryWrapper = new LambdaQueryWrapper<>();
  664. pmReleaseAnnouncementLambdaQueryWrapper.eq(PmReleaseAnnouncement::getDemandId, vo.getDemandId())
  665. .orderByDesc(PmReleaseAnnouncement::getReleaseTime)
  666. .last(" limit 1");
  667. PmReleaseAnnouncement pmReleaseAnnouncement = this.pmReleaseAnnouncementService.getOne(pmReleaseAnnouncementLambdaQueryWrapper);
  668. if (pmReleaseAnnouncement != null) {
  669. vo.setAnnouncementReleaseTime(pmReleaseAnnouncement.getReleaseTime());
  670. vo.setTenderOpenTime(pmReleaseAnnouncement.getTenderOpenTime());
  671. }
  672. }
  673. if (Integer.parseInt(vo.getProjectStatus()) > 15 && Integer.parseInt(vo.getProjectStatus()) != 16 && Integer.parseInt(vo.getProjectStatus()) != 18) {
  674. LambdaQueryWrapper<PmBidWinning> pmBidWinningLambdaQueryWrapper = new LambdaQueryWrapper<>();
  675. pmBidWinningLambdaQueryWrapper.eq(PmBidWinning::getDemandId, vo.getDemandId()).eq(PmBidWinning::getStatus, BidWinningStatus.NORMAL.getCode())
  676. .orderByDesc(PmBidWinning::getBidAnnouncementTime)
  677. .last(" limit 1");
  678. PmBidWinning pmBidWinning = this.pmBidWinningService.getOne(pmBidWinningLambdaQueryWrapper);
  679. if (pmBidWinning != null) {
  680. vo.setBidAnnouncementTime(pmBidWinning.getBidAnnouncementTime());
  681. }
  682. }
  683. }
  684. results.setRecords(pmDemandResVos);
  685. }
  686. return results;
  687. }
  688. /**
  689. * 需求建档
  690. *
  691. * @param vo 采购需求
  692. * @return 结果
  693. */
  694. @Override
  695. @Transactional(rollbackFor = Exception.class)
  696. public boolean bookBuilding(PmBookBuildingReqVo vo) throws Exception {
  697. PmDemand pmDemand = this.getById(vo.getDemandId());
  698. LambdaQueryWrapper<PmBookBuilding> lambdaQueryWrapper = new LambdaQueryWrapper<>();
  699. lambdaQueryWrapper.eq(PmBookBuilding::getDemandId, vo.getDemandId());
  700. PmBookBuilding pmBookBuilding = pmBookBuildingService.getOne(lambdaQueryWrapper);
  701. if (pmBookBuilding != null) {
  702. vo.setId(pmBookBuilding.getId());
  703. BeanUtils.copyProperties(vo, pmBookBuilding);
  704. pmBookBuilding.setUpdateBy(vo.getUpdateBy());
  705. pmBookBuilding.setUpdateTime(new Date());
  706. } else {
  707. pmBookBuilding = new PmBookBuilding();
  708. BeanUtils.copyProperties(vo, pmBookBuilding);
  709. pmBookBuilding.setCreateBy(vo.getUpdateBy());
  710. pmBookBuilding.setCreateTime(new Date());
  711. pmBookBuilding.setUpdateBy(vo.getUpdateBy());
  712. pmBookBuilding.setUpdateTime(pmBookBuilding.getCreateTime());
  713. }
  714. if (pmBookBuildingService.saveOrUpdate(pmBookBuilding)) {
  715. List<SysFileRef> sysFileRefs = vo.getSysFileRefs();
  716. uploadFile(pmBookBuilding.getId(), SysFileRefEnum.PM_BOOK_BUILDING.getType(), sysFileRefs, vo.getUpdateBy());
  717. PmDemand pmDemandUpdate = new PmDemand();
  718. pmDemandUpdate.setDemandId(pmDemand.getDemandId());
  719. pmDemandUpdate.setProjectStatus(PmProjectStatus.DEMAND_WAIT_COMMIT.getCode());
  720. pmDemandUpdate.setEvaluation(vo.getBudgetAmount());
  721. pmDemandUpdate.setProjectType(vo.getProjectType());
  722. pmDemandUpdate.setPurchaseMode(vo.getPurchaseMode());
  723. pmDemandUpdate.setUpdateBy(vo.getUpdateBy());
  724. pmDemandUpdate.setUpdateTime(DateUtils.getNowDate());
  725. return this.updateById(pmDemandUpdate);
  726. } else {
  727. return false;
  728. }
  729. }
  730. private List<SysFileInfo> getSysFileInfoList(Long redId, Integer type) {
  731. HashMap<String, Object> map = new HashMap<>();
  732. map.put("red_id", redId);
  733. map.put("type", type);
  734. List<SysFileRef> fileRefs = sysFileRefService.listByMap(map);
  735. if (!ObjectUtils.isEmpty(fileRefs)) {
  736. List<SysFileInfo> fileInfos = new ArrayList<>();
  737. for (SysFileRef ref : fileRefs) {
  738. SysFileInfo fileInfo = fileService.getById(ref.getFileId());
  739. fileInfos.add(fileInfo);
  740. }
  741. return fileInfos;
  742. } else {
  743. return null;
  744. }
  745. }
  746. /**
  747. * 提交采购需求
  748. *
  749. * @param pmDemandReqVo
  750. * @return 结果
  751. */
  752. @Override
  753. @Transactional(rollbackFor = Exception.class)
  754. public boolean commit(PmDemandReqVo pmDemandReqVo) {
  755. PmDemand pmDemand = this.getById(pmDemandReqVo.getDemandId());
  756. SysUser sysUser = userService.selectUserById(SecurityUtils.getUserId());
  757. Long deptId = sysUser.getDeptId();
  758. pmAuditDeptRefService.insertPmAuditDeptRefs(pmDemandReqVo.getDemandId()
  759. , "2"
  760. , deptId
  761. , BigDecimal.valueOf(pmDemand.getEvaluation())
  762. , sysUser.getUserId()
  763. , pmDemand.getProjectType());
  764. PmDemand pmDemandUpdate = new PmDemand();
  765. pmDemandUpdate.setDemandId(pmDemand.getDemandId());
  766. pmDemandUpdate.setProjectStatus(PmProjectStatus.DEMAND_WAIT_AUDIT.getCode());
  767. pmDemandUpdate.setRealDemandCommitTime(DateUtils.getNowDate());
  768. pmDemandUpdate.setUpdateBy(pmDemandReqVo.getUpdateBy());
  769. pmDemandUpdate.setUpdateTime(DateUtils.getNowDate());
  770. List<SysDictData> data = iSysDictTypeService.selectDictDataByType("alert_time_setting");
  771. int setting2 = Integer.parseInt(data.stream().filter(item -> item.getDictLabel().equals("计划完成时间")).collect(Collectors.toList()).get(0).getDictValue());
  772. log.info("******** setting2 == " + setting2);
  773. //采购完成时间:根据数据阈值中设置的采购完成时间进行判断,进行预警
  774. int diff2 = DateUtils.differentDaysByMillisecond(pmDemand.getPlanPurchaseFinishTime(), DateUtils.parseDate(DateUtils.getDate()));
  775. if (ObjectUtils.isEmpty(pmDemand.getRealPurchaseFinishTime()) && diff2 > 0 && diff2 <= setting2) {
  776. log.info("******** 采购完成预警: " + pmDemand.getProjectName());
  777. pmDemandUpdate.setWarnStatus(WarnStatus.PURCHASE_FINISH_WARNING.getCode());
  778. } else {
  779. pmDemandUpdate.setWarnStatus(WarnStatus.NORMAL.getCode());
  780. }
  781. return this.updateById(pmDemandUpdate);
  782. }
  783. /**
  784. * 查看流程图
  785. *
  786. * @param demandId 采购需求主键
  787. * @return 采购需求
  788. */
  789. @Override
  790. public Object viewFlowChart(Long demandId) {
  791. PmDemand pmDemand = this.getById(demandId);
  792. String projectStatus = String.valueOf(pmDemand.getProjectStatus());
  793. String moduleName = null;
  794. if (PmProjectStatus.DEMAND_WAIT_FILL.getCode().equals(projectStatus)
  795. || PmProjectStatus.DEMAND_AUDIT_RETURN.getCode().equals(projectStatus)
  796. || PmProjectStatus.WASTE_BID_RETURN.getCode().equals(projectStatus)) {
  797. moduleName = "需求填制";
  798. } else if (PmProjectStatus.DEMAND_WAIT_COMMIT.getCode().equals(projectStatus)) {
  799. moduleName = "需求提交";
  800. } else if (PmProjectStatus.DEMAND_WAIT_AUDIT.getCode().equals(projectStatus)) {
  801. moduleName = "需求审核";
  802. } else if (PmProjectStatus.TASK_WAIT_RELEASE.getCode().equals(projectStatus)) {
  803. moduleName = "任务下达";
  804. } else if (PmProjectStatus.PURCHASE_DEMAND_DOCKING.getCode().equals(projectStatus)) {
  805. moduleName = "选取代理";
  806. } else if (PmProjectStatus.EXPERT_FEEDBACK.getCode().equals(projectStatus)) {
  807. moduleName = "上传意见反馈单";
  808. } else if (PmProjectStatus.PROCUREMENT_DOCUMENTS_REVIEW.getCode().equals(projectStatus)) {
  809. moduleName = "上传招标文件审批表";
  810. } else if (PmProjectStatus.PROCUREMENT_ANNOUNCEMENT.getCode().equals(projectStatus)) {
  811. moduleName = "采购公告发布";
  812. } else if (PmProjectStatus.PRE_BID_QUERY.getCode().equals(projectStatus)) {
  813. moduleName = "标前质疑投诉";
  814. } else if (PmProjectStatus.WAIT_OPEN_BID.getCode().equals(projectStatus)) {
  815. moduleName = "填写专家信息,开评标";
  816. } else if (PmProjectStatus.BID_RESULT_ANNOUNCEMENT.getCode().equals(projectStatus) || PmProjectStatus.WASTE_BID_HANDLE.getCode().equals(projectStatus)) {
  817. moduleName = "评标结果公告";
  818. } else if (PmProjectStatus.POST_BID_QUERY.getCode().equals(projectStatus)) {
  819. moduleName = "质疑处理,上传中标通知书";
  820. } else if (PmProjectStatus.CONTRACT_WAIT_FILL.getCode().equals(projectStatus)) {
  821. moduleName = "合同填制";
  822. } else if (PmProjectStatus.UNDER_CONSTRUCTION.getCode().equals(projectStatus)) {
  823. moduleName = "建设文档填制";
  824. } else if (PmProjectStatus.COMPLETION_CONSTRUCTION.getCode().equals(projectStatus)) {
  825. moduleName = "项目归档";
  826. }
  827. return moduleName;
  828. }
  829. /**
  830. * 审核采购需求通过
  831. *
  832. * @param pmDemandReqVo
  833. * @return 结果
  834. */
  835. @Override
  836. @Transactional(rollbackFor = Exception.class)
  837. public boolean reviewTo(PmDemandReqVo pmDemandReqVo) {
  838. PmDemand pmDemand = this.getById(pmDemandReqVo.getDemandId());
  839. PmDemand pmDemandUpdate = new PmDemand();
  840. pmDemandUpdate.setDemandId(pmDemand.getDemandId());
  841. SysUser sysUser = userService.selectUserById(SecurityUtils.getUserId());
  842. Long deptId = sysUser.getDeptId();
  843. SysDept sysDept = deptMapper.selectDeptById(deptId);
  844. String[] ancestors = sysDept.getAncestors().split(",");
  845. String deptLevel = null;
  846. if (ancestors.length == 2) { //C级
  847. deptLevel = "C";
  848. } else if (ancestors.length == 3) { //B级
  849. deptLevel = "B";
  850. } else if (ancestors.length == 4) { //A级
  851. deptLevel = "A";
  852. }
  853. LambdaQueryWrapper<PmAuditDeptRef> lw = new LambdaQueryWrapper();
  854. lw.eq(PmAuditDeptRef::getRefId, pmDemandReqVo.getDemandId());
  855. lw.eq(PmAuditDeptRef::getRefType, "2");
  856. List<PmAuditDeptRef> list = pmAuditDeptRefService.list(lw);
  857. boolean flay = true;
  858. if (!ObjectUtils.isEmpty(list)) {
  859. for (PmAuditDeptRef pmAuditDeptRef : list) {
  860. // 判断 deptLevel 是否还有更高的 且是 待审核的数据
  861. if (pmAuditDeptRef.getDeptLevel().compareTo(deptLevel) > 0
  862. && pmAuditDeptRef.getStatus().equals(Integer.parseInt("0"))) {
  863. flay = false;
  864. }
  865. // 更新当前 deptLevel 级别的审核状态
  866. if (pmAuditDeptRef.getDeptLevel().compareTo(deptLevel) == 0) {
  867. pmAuditDeptRef.setStatus(1);
  868. pmAuditDeptRefService.updateById(pmAuditDeptRef);
  869. }
  870. }
  871. }
  872. if (flay) {
  873. pmDemandUpdate.setProjectStatus(PmProjectStatus.TASK_WAIT_RELEASE.getCode());
  874. }
  875. List<SysFileRef> sysFileRefs = pmDemandReqVo.getSysFileRefs();
  876. uploadFile(pmDemandReqVo.getDemandId(), SysFileRefEnum.PM_DEMAND_EXAMINE.getType(), sysFileRefs, pmDemandReqVo.getUpdateBy());
  877. pmDemandUpdate.setUpdateBy(pmDemandReqVo.getUpdateBy());
  878. pmDemandUpdate.setUpdateTime(DateUtils.getNowDate());
  879. pmDemandUpdate.setAuditTime(DateUtils.getNowDate());
  880. return this.updateById(pmDemandUpdate);
  881. }
  882. /**
  883. * 审核采购需求退回
  884. *
  885. * @param pmDemandReqVo
  886. * @return 结果
  887. */
  888. @Override
  889. @Transactional(rollbackFor = Exception.class)
  890. public boolean reviewReturn(PmDemandReqVo pmDemandReqVo) {
  891. UpdateWrapper<PmDemand> updateWrapper = new UpdateWrapper<>();
  892. updateWrapper.lambda().eq(PmDemand::getDemandId, pmDemandReqVo.getDemandId())
  893. .set(PmDemand::getProjectStatus, PmProjectStatus.DEMAND_AUDIT_RETURN.getCode())
  894. .set(PmDemand::getAdjustReason, pmDemandReqVo.getRefuseReason())
  895. .set(PmDemand::getRealDemandCommitTime, null)
  896. .set(PmDemand::getUpdateBy, pmDemandReqVo.getUpdateBy())
  897. .set(PmDemand::getUpdateTime, DateUtils.getNowDate())
  898. .set(PmDemand::getAuditTime, DateUtils.getNowDate());
  899. LambdaQueryWrapper<PmAuditDeptRef> lw = new LambdaQueryWrapper();
  900. lw.eq(PmAuditDeptRef::getRefId, pmDemandReqVo.getDemandId());
  901. lw.eq(PmAuditDeptRef::getRefType, "2");
  902. pmAuditDeptRefService.remove(lw);
  903. return this.update(updateWrapper);
  904. }
  905. /**
  906. * 下达任务
  907. *
  908. * @param pmDemandReqVo
  909. * @return 结果
  910. */
  911. @Override
  912. @Transactional(rollbackFor = Exception.class)
  913. public boolean releaseTask(PmDemandReqVo pmDemandReqVo) {
  914. PmDemand pmDemand = new PmDemand();
  915. pmDemand.setDemandId(pmDemandReqVo.getDemandId());
  916. pmDemand.setTaskReleaseTime(pmDemandReqVo.getTaskReleaseTime());
  917. pmDemand.setProjectStatus(PmProjectStatus.PURCHASE_DEMAND_DOCKING.getCode());
  918. List<SysFileRef> sysFileRefs = pmDemandReqVo.getSysFileRefs();
  919. uploadFile(pmDemandReqVo.getDemandId(), SysFileRefEnum.PM_TAST_RELEASE.getType(), sysFileRefs, pmDemandReqVo.getUpdateBy());
  920. pmDemand.setUpdateBy(pmDemandReqVo.getUpdateBy());
  921. pmDemand.setUpdateTime(DateUtils.getNowDate());
  922. pmDemand.setAuditTime(DateUtils.getNowDate());
  923. return this.updateById(pmDemand);
  924. }
  925. @Override
  926. @Transactional(rollbackFor = Exception.class)
  927. public boolean uploadFile(Long redId, Integer fileType, List<SysFileRef> sysFileRefs, String upateBy, boolean delOld) {
  928. if (!ObjectUtils.isEmpty(sysFileRefs)) {
  929. // 删关联
  930. LambdaQueryWrapper<SysFileRef> lw = new LambdaQueryWrapper<>();
  931. lw.eq(SysFileRef::getRedId, redId);
  932. lw.eq(SysFileRef::getType, fileType);
  933. sysFileRefMapper.delete(lw);
  934. //添加新的
  935. for (SysFileRef ref : sysFileRefs) {
  936. if (ref.getFileId() == null) {
  937. continue;
  938. }
  939. ref.setRedId(redId);
  940. ref.setType(fileType);
  941. ref.setCreated(upateBy);
  942. ref.setCreateTime(new Date());
  943. ref.setUpdated(upateBy);
  944. ref.setUpdateTime(ref.getCreateTime());
  945. sysFileRefService.save(ref);
  946. }
  947. return true;
  948. } else {
  949. return false;
  950. }
  951. }
  952. @Override
  953. @Transactional(rollbackFor = Exception.class)
  954. public boolean uploadFile(Long redId, Integer fileType, List<SysFileRef> sysFileRefs, String upateBy) {
  955. return uploadFile(redId, fileType, sysFileRefs, upateBy, false);
  956. }
  957. @Override
  958. @Transactional(rollbackFor = Exception.class)
  959. public boolean insertPmReleaseAnnouncement(PmReleaseAnnouncementReqVo pmReleaseAnnouncementReqVo) throws Exception {
  960. PmDemand pmDemand = this.getById(pmReleaseAnnouncementReqVo.getDemandId());
  961. if (ObjectUtils.isEmpty(pmDemand)) {
  962. throw new Exception("参数错误");
  963. }
  964. if (ObjectUtils.isEmpty(pmReleaseAnnouncementReqVo.getSysFileRefs())) {
  965. throw new Exception("上传附件不能为空");
  966. }
  967. PmReleaseAnnouncement pmReleaseAnnouncement = new PmReleaseAnnouncement();
  968. BeanUtils.copyProperties(pmReleaseAnnouncementReqVo, pmReleaseAnnouncement);
  969. if (pmReleaseAnnouncementService.saveOrUpdate(pmReleaseAnnouncement)) {
  970. uploadFile(pmReleaseAnnouncement.getId(), SysFileRefEnum.PM_ANNOUNCEMENT_FILE.getType(), pmReleaseAnnouncementReqVo.getSysFileRefs(), pmReleaseAnnouncementReqVo.getUpdateBy());
  971. PmDemand pmDemandUpdate = new PmDemand();
  972. pmDemandUpdate.setDemandId(pmReleaseAnnouncementReqVo.getDemandId());
  973. pmDemandUpdate.setProjectStatus(PmProjectStatus.PRE_BID_QUERY.getCode());
  974. pmDemandUpdate.setUpdateTime(pmReleaseAnnouncementReqVo.getUpdateTime());
  975. pmDemandUpdate.setUpdateBy(pmReleaseAnnouncementReqVo.getUpdateBy());
  976. if (this.updateById(pmDemandUpdate)) {
  977. //发布公告生成后,会默认将该数据同步到公告管理和首页中
  978. BaseNotice baseNotice = new BaseNotice();
  979. baseNotice.setName(pmDemand.getProjectName());
  980. baseNotice.setTitle(pmDemand.getProjectName() + "招标公告");
  981. LambdaQueryWrapper<BaseNoticeType> lambdaQueryWrapper = new LambdaQueryWrapper<>();
  982. lambdaQueryWrapper.eq(BaseNoticeType::getName, "招标公告");
  983. BaseNoticeType baseNoticeType = baseNoticeTypeService.getOne(lambdaQueryWrapper);
  984. if (baseNoticeType == null) {
  985. throw new Exception("招标公告 公告类型不存在");
  986. }
  987. baseNotice.setDemandId(pmDemand.getDemandId());
  988. baseNotice.setDeptId(pmDemand.getPurchaseDeptId());
  989. baseNotice.setIsExcess(pmDemand.getIsExcess());
  990. baseNotice.setType(baseNoticeType.getId());
  991. baseNotice.setReleaseTime(pmReleaseAnnouncement.getReleaseTime());
  992. baseNotice.setCreated(pmReleaseAnnouncementReqVo.getCreateBy());
  993. baseNotice.setCreateTime(pmReleaseAnnouncementReqVo.getCreateTime());
  994. baseNotice.setUpdated(pmReleaseAnnouncementReqVo.getUpdateBy());
  995. baseNotice.setUpdateTime(pmReleaseAnnouncementReqVo.getUpdateTime());
  996. return this.baseNoticeService.saveOrUpdate(baseNotice);
  997. } else {
  998. return false;
  999. }
  1000. } else {
  1001. return false;
  1002. }
  1003. }
  1004. @Override
  1005. @Transactional(rollbackFor = Exception.class)
  1006. public boolean insertExpertBatch(PmBaseExpertFillReqVo pmBaseExpertFillReqVo) throws Exception {
  1007. PmDemand pmDemand = this.getById(pmBaseExpertFillReqVo.getDemandId());
  1008. if (ObjectUtils.isEmpty(pmDemand)) {
  1009. throw new Exception("参数错误");
  1010. }
  1011. List<BaseExpert> baseExpertList = pmBaseExpertFillReqVo.getBaseExpertList();
  1012. if (ObjectUtils.isEmpty(baseExpertList)) {
  1013. throw new Exception("参数错误");
  1014. }
  1015. Date now = new Date();
  1016. for (BaseExpert baseExpert : baseExpertList) {
  1017. if (NameListType.BLACK.getCode().equals(baseExpert.getStatus())) {
  1018. throw new Exception("该专家(身份证号:" + baseExpert.getIdNumber() + ")属于黑名单");
  1019. } else {
  1020. if (ObjectUtils.isEmpty(baseExpert.getStatus())) {
  1021. baseExpert.setStatus(NameListType.WHITE.getCode());
  1022. }
  1023. }
  1024. if (!ObjectUtils.isEmpty(baseExpert.getVarietyPurchase()) && !baseExpert.getVarietyPurchase().contains(pmDemand.getProjectType())) {
  1025. throw new Exception("该专家(身份证号:" + baseExpert.getIdNumber() + ")所属采购品种和项目类型不匹配");
  1026. } else {
  1027. baseExpert.setVarietyPurchase(pmDemand.getProjectType());
  1028. }
  1029. if (ObjectUtils.isEmpty(baseExpert.getCreated())) {
  1030. baseExpert.setCreated(pmBaseExpertFillReqVo.getCreateBy());
  1031. baseExpert.setCreateTime(now);
  1032. }
  1033. if (ObjectUtils.isEmpty(baseExpert.getUpdated())) {
  1034. baseExpert.setUpdated(pmBaseExpertFillReqVo.getUpdateBy());
  1035. baseExpert.setUpdateTime(now);
  1036. }
  1037. if (ObjectUtils.isEmpty(baseExpert.getId())) {
  1038. LambdaQueryWrapper<BaseExpert> lambdaQueryWrapper = new LambdaQueryWrapper<>();
  1039. lambdaQueryWrapper.eq(BaseExpert::getIdNumber, baseExpert.getIdNumber());
  1040. BaseExpert baseExpert1 = baseExpertService.getOne(lambdaQueryWrapper);
  1041. if (!ObjectUtils.isEmpty(baseExpert1)) {
  1042. baseExpert.setId(baseExpert1.getId());
  1043. }
  1044. }
  1045. if (baseExpertService.saveOrUpdate(baseExpert)) {
  1046. LambdaQueryWrapper<PmDemandExpertRef> pmDemandExpertRefLambdaQueryWrapper = new LambdaQueryWrapper<>();
  1047. pmDemandExpertRefLambdaQueryWrapper.eq(PmDemandExpertRef::getDemandId, pmDemand.getDemandId())
  1048. .eq(PmDemandExpertRef::getExpertId, baseExpert.getId().longValue())
  1049. .eq(PmDemandExpertRef::getAccessTime, pmBaseExpertFillReqVo.getAccessTime());
  1050. PmDemandExpertRef pmDemandExpertRef = pmDemandExpertRefService.getOne(pmDemandExpertRefLambdaQueryWrapper);
  1051. if (pmDemandExpertRef == null) {
  1052. pmDemandExpertRef = new PmDemandExpertRef();
  1053. pmDemandExpertRef.setCreateBy(pmBaseExpertFillReqVo.getCreateBy());
  1054. pmDemandExpertRef.setCreateTime(now);
  1055. }
  1056. pmDemandExpertRef.setDemandId(pmDemand.getDemandId());
  1057. pmDemandExpertRef.setExpertId(baseExpert.getId().longValue());
  1058. pmDemandExpertRef.setAccessTime(DateUtils.parseDate(pmBaseExpertFillReqVo.getAccessTime()));
  1059. pmDemandExpertRef.setUpdateBy(pmBaseExpertFillReqVo.getCreateBy());
  1060. pmDemandExpertRef.setUpdateTime(pmDemandExpertRef.getCreateTime());
  1061. pmDemandExpertRefService.saveOrUpdate(pmDemandExpertRef);
  1062. //专家单位
  1063. if (StringUtils.isNotNull(baseExpert.getUnitInformation())) {
  1064. List<BaseUnitInformation> baseUnitInformationList = baseExpertMapper.selectByUnitInformation(baseExpert.getUnitInformation());
  1065. if (baseUnitInformationList.size() <= 0) {
  1066. BaseUnitInformation baseUnitInformation = new BaseUnitInformation();
  1067. baseUnitInformation.setUnitName(baseExpert.getUnitInformation());
  1068. baseUnitInformation.setVarietyPurchase(baseExpert.getVarietyPurchase());
  1069. baseUnitInformation.setCreated(baseExpert.getExpertName());
  1070. baseUnitInformation.setCreateTime(new Date());
  1071. Integer i = baseExpertMapper.insertBaseUnitInformation(baseUnitInformation);
  1072. }
  1073. }
  1074. }
  1075. }
  1076. PmDemand pmDemandUpdate = new PmDemand();
  1077. pmDemandUpdate.setDemandId(pmDemand.getDemandId());
  1078. pmDemandUpdate.setHasExpert("1");
  1079. this.updateById(pmDemandUpdate);
  1080. return true;
  1081. }
  1082. @Override
  1083. @Transactional(rollbackFor = Exception.class)
  1084. public boolean extractExpertBatch(PmBaseExpertExtractReqVo pmBaseExpertExtractReqVo) throws Exception {
  1085. PmDemand pmDemand = this.getById(pmBaseExpertExtractReqVo.getDemandId());
  1086. if (ObjectUtils.isEmpty(pmDemand)) {
  1087. throw new Exception("参数错误");
  1088. }
  1089. String professional = pmBaseExpertExtractReqVo.getProfessional();
  1090. if (ObjectUtils.isEmpty(professional)) {
  1091. throw new Exception("必须选择专家专业");
  1092. }
  1093. String localArea = pmBaseExpertExtractReqVo.getLocalArea();
  1094. if (ObjectUtils.isEmpty(localArea)) {
  1095. throw new Exception("必须选择地域");
  1096. }
  1097. if (!StringUtils.isNumeric(localArea)) {
  1098. throw new Exception("地域必须传数字代码");
  1099. }
  1100. Integer technicalExpertNumber = pmBaseExpertExtractReqVo.getTechnicalExpertNumber();
  1101. if (technicalExpertNumber == null) {
  1102. technicalExpertNumber = 0;
  1103. }
  1104. Integer economicExpertNumber = pmBaseExpertExtractReqVo.getEconomicExpertNumber();
  1105. if (economicExpertNumber == null) {
  1106. economicExpertNumber = 0;
  1107. }
  1108. Integer legalAffairsExpertNumber = pmBaseExpertExtractReqVo.getLegalAffairsExpertNumber();
  1109. if (legalAffairsExpertNumber == null) {
  1110. legalAffairsExpertNumber = 0;
  1111. }
  1112. Integer spareExpertNumber = pmBaseExpertExtractReqVo.getSpareExpertNumber();
  1113. if (spareExpertNumber == null) {
  1114. spareExpertNumber = 0;
  1115. }
  1116. if (technicalExpertNumber + economicExpertNumber + legalAffairsExpertNumber + spareExpertNumber == 0) {
  1117. throw new Exception("必须至少填写一个数量");
  1118. }
  1119. String needAvoidUnit = pmBaseExpertExtractReqVo.getNeedAvoidUnit();
  1120. List<String> needAvoidUnitList = null;
  1121. if (!ObjectUtils.isEmpty(needAvoidUnit)) {
  1122. String[] arr = needAvoidUnit.split(",");
  1123. needAvoidUnitList = Arrays.asList(arr);
  1124. }
  1125. List<String> sysRegionCodeList = new ArrayList<>();
  1126. if (!ObjectUtils.isEmpty(localArea)) {
  1127. sysRegionCodeList.add(localArea);
  1128. //找到该地域code对应的子列表
  1129. List<SysRegionVO> sysRegionVOList = iSysRegionService.findChildDivisions(localArea);
  1130. if (!ObjectUtils.isEmpty(sysRegionVOList)) {
  1131. for (SysRegionVO vo : sysRegionVOList) {
  1132. sysRegionCodeList.add(vo.getCode());
  1133. }
  1134. }
  1135. }
  1136. //从专家库中查询符合项目类型的以及是白名单的全部列表
  1137. LambdaQueryWrapper<BaseExpert> lw = new LambdaQueryWrapper<>();
  1138. lw.eq(BaseExpert::getVarietyPurchase, pmDemand.getProjectType())
  1139. .eq(BaseExpert::getStatus, NameListType.WHITE.getCode())
  1140. .notIn(!ObjectUtils.isEmpty(needAvoidUnitList), BaseExpert::getUnitInformation, needAvoidUnitList)
  1141. .in(!ObjectUtils.isEmpty(sysRegionCodeList), BaseExpert::getLocalArea, sysRegionCodeList); //地域
  1142. List<BaseExpert> baseExpertList = baseExpertService.list(lw);
  1143. if (ObjectUtils.isEmpty(baseExpertList)) {
  1144. throw new Exception("没抽取到符合条件的专家");
  1145. }
  1146. //从列表中挑出来各个类型的子列表
  1147. List<BaseExpert> technicalExpertList = new ArrayList<>();
  1148. List<BaseExpert> economicExpertList = new ArrayList<>();
  1149. List<BaseExpert> legalAffairsExpertList = new ArrayList<>();
  1150. List<BaseExpert> spareExpertList = new ArrayList<>();
  1151. String[] arr = professional.split(",");
  1152. List<String> professionalList = Arrays.asList(arr);
  1153. for (BaseExpert baseExpert : baseExpertList) {
  1154. //专业类型判断
  1155. String majorType = baseExpert.getMajorType();
  1156. if (!ObjectUtils.isEmpty(majorType)) {
  1157. String[] arr2 = majorType.split(",");
  1158. List<String> majorTypeList = Arrays.asList(arr2);
  1159. if (!hasIntersection(professionalList, majorTypeList)) { //不符合专业类型
  1160. continue;
  1161. }
  1162. }
  1163. //备用专家
  1164. if (spareExpertNumber > 0) { //都加进去
  1165. spareExpertList.add(baseExpert);
  1166. }
  1167. if (technicalExpertNumber > 0) {
  1168. if (baseExpert.getExpertType().contains(ExpertType.TECHNICAL_EXPERT.getCode())) {
  1169. technicalExpertList.add(baseExpert);
  1170. continue;
  1171. }
  1172. }
  1173. if (economicExpertNumber > 0) {
  1174. if (baseExpert.getExpertType().contains(ExpertType.ECONOMIC_EXPERT.getCode())) {
  1175. economicExpertList.add(baseExpert);
  1176. continue;
  1177. }
  1178. }
  1179. if (legalAffairsExpertNumber > 0) {
  1180. if (baseExpert.getExpertType().contains(ExpertType.LEGALAFFAIRS_EXPERT.getCode())) {
  1181. legalAffairsExpertList.add(baseExpert);
  1182. continue;
  1183. }
  1184. }
  1185. }
  1186. //从子列表中随机抽取符合数据量的
  1187. List<BaseExpert> alltExpertList = new ArrayList<>();
  1188. if (technicalExpertNumber > 0 && technicalExpertList.size() < technicalExpertNumber) {
  1189. throw new Exception("抽取到符合条件的技术专家数量不够");
  1190. }
  1191. if (!ObjectUtils.isEmpty(technicalExpertList)) {
  1192. alltExpertList.addAll(RandomUtil.getRandomList(technicalExpertList, technicalExpertNumber));
  1193. }
  1194. if (economicExpertNumber > 0 && economicExpertList.size() < economicExpertNumber) {
  1195. throw new Exception("抽取到符合条件的经济专家数量不够");
  1196. }
  1197. if (!ObjectUtils.isEmpty(economicExpertList)) {
  1198. alltExpertList.addAll(RandomUtil.getRandomList(economicExpertList, economicExpertNumber));
  1199. }
  1200. if (legalAffairsExpertNumber > 0 && legalAffairsExpertList.size() < legalAffairsExpertNumber) {
  1201. throw new Exception("抽取到符合条件的法务专家数量不够");
  1202. }
  1203. if (!ObjectUtils.isEmpty(legalAffairsExpertList)) {
  1204. alltExpertList.addAll(RandomUtil.getRandomList(legalAffairsExpertList, legalAffairsExpertNumber));
  1205. }
  1206. List<BaseExpert> spareExpertListNew = new ArrayList<>();
  1207. if (!ObjectUtils.isEmpty(spareExpertList)) {
  1208. //获取全部IDlist
  1209. List<Integer> allExpertIdList = new ArrayList<>();
  1210. if (!ObjectUtils.isEmpty(alltExpertList)) {
  1211. for (BaseExpert baseExpert : alltExpertList) {
  1212. allExpertIdList.add(baseExpert.getId());
  1213. }
  1214. }
  1215. //遍历全部IDlist
  1216. if (!ObjectUtils.isEmpty(allExpertIdList)) { //去重
  1217. for (BaseExpert baseExpert : spareExpertList) {
  1218. if (!allExpertIdList.contains(baseExpert.getId())) {
  1219. spareExpertListNew.add(baseExpert);
  1220. }
  1221. }
  1222. } else {
  1223. spareExpertListNew = spareExpertList;
  1224. }
  1225. if (!ObjectUtils.isEmpty(spareExpertListNew)) {
  1226. alltExpertList.addAll(RandomUtil.getRandomList(spareExpertListNew, spareExpertNumber));
  1227. }
  1228. }
  1229. if (spareExpertNumber > 0 && spareExpertListNew.size() < spareExpertNumber) {
  1230. throw new Exception("抽取到符合条件的备用专家数量不够");
  1231. }
  1232. if (ObjectUtils.isEmpty(alltExpertList)) {
  1233. throw new Exception("没抽取到符合条件的专家");
  1234. } else {
  1235. List<PmDemandExpertRef> pmDemandExpertRefList = new ArrayList<>();
  1236. for (BaseExpert baseExpert : alltExpertList) {
  1237. LambdaQueryWrapper<PmDemandExpertRef> baseExpertLambdaQueryWrapper = new LambdaQueryWrapper<>();
  1238. baseExpertLambdaQueryWrapper.eq(PmDemandExpertRef::getExpertId, baseExpert.getId().longValue())
  1239. .eq(PmDemandExpertRef::getDemandId, pmDemand.getDemandId())
  1240. .eq(PmDemandExpertRef::getAccessTime, pmBaseExpertExtractReqVo.getAccessTime());
  1241. PmDemandExpertRef pmDemandExpertRef = pmDemandExpertRefService.getOne(baseExpertLambdaQueryWrapper);
  1242. if (pmDemandExpertRef == null) {
  1243. pmDemandExpertRef = new PmDemandExpertRef();
  1244. pmDemandExpertRef.setCreateBy(pmBaseExpertExtractReqVo.getCreateBy());
  1245. pmDemandExpertRef.setCreateTime(new Date());
  1246. }
  1247. pmDemandExpertRef.setDemandId(pmDemand.getDemandId());
  1248. pmDemandExpertRef.setExpertId(baseExpert.getId().longValue());
  1249. pmDemandExpertRef.setAccessTime(DateUtils.parseDate(pmBaseExpertExtractReqVo.getAccessTime()));
  1250. pmDemandExpertRef.setUpdateBy(pmBaseExpertExtractReqVo.getCreateBy());
  1251. pmDemandExpertRef.setUpdateTime(pmDemandExpertRef.getCreateTime());
  1252. pmDemandExpertRefList.add(pmDemandExpertRef);
  1253. }
  1254. PmDemand pmDemandUpdate = new PmDemand();
  1255. pmDemandUpdate.setDemandId(pmDemand.getDemandId());
  1256. pmDemandUpdate.setHasExpert("1");
  1257. this.updateById(pmDemandUpdate);
  1258. return pmDemandExpertRefService.saveOrUpdateBatch(pmDemandExpertRefList);
  1259. }
  1260. }
  1261. //二个列表是否有交集
  1262. private boolean hasIntersection(List<String> professionalList, List<String> majorTypeList) {
  1263. for (String professiona : professionalList) {
  1264. for (String majorType : majorTypeList) {
  1265. if (professiona.equals(majorType)) {
  1266. return true;
  1267. }
  1268. }
  1269. }
  1270. return false;
  1271. }
  1272. @Override
  1273. @Transactional(rollbackFor = Exception.class)
  1274. public boolean insertBidOpeningBatch(PmBidOpeningFillReqVo pmBidOpeningFillReqVo) throws Exception {
  1275. PmDemand pmDemand = this.getById(pmBidOpeningFillReqVo.getDemandId());
  1276. if (ObjectUtils.isEmpty(pmDemand)) {
  1277. throw new Exception("参数错误");
  1278. }
  1279. //从发布公告里获取开标时间
  1280. LambdaQueryWrapper<PmReleaseAnnouncement> lw = new LambdaQueryWrapper<>();
  1281. lw.eq(PmReleaseAnnouncement::getDemandId, pmDemand.getDemandId()).orderByDesc(PmReleaseAnnouncement::getReleaseTime)
  1282. .last(" limit 1 ");
  1283. PmReleaseAnnouncement pmReleaseAnnouncement = this.pmReleaseAnnouncementService.getOne(lw);
  1284. if (pmReleaseAnnouncement == null) {
  1285. throw new Exception("发布公告不存在");
  1286. }
  1287. Date tenderOpenTime = pmReleaseAnnouncement.getTenderOpenTime();
  1288. Date now = new Date();
  1289. List<PmBidOpening> pmBidOpeningList = pmBidOpeningFillReqVo.getPmBidOpeningList();
  1290. for (PmBidOpening pmBidOpening : pmBidOpeningList) {
  1291. if (ObjectUtils.isEmpty(pmBidOpening.getBidderName())) {
  1292. throw new Exception("投标人名称不能为空");
  1293. }
  1294. if (ObjectUtils.isEmpty(pmBidOpening.getScore())) {
  1295. throw new Exception("分数不能为空");
  1296. }
  1297. pmBidOpening.setOpenBidTime(tenderOpenTime);
  1298. pmBidOpening.setDemandId(pmBidOpeningFillReqVo.getDemandId());
  1299. pmBidOpening.setCreateBy(pmBidOpeningFillReqVo.getCreateBy());
  1300. pmBidOpening.setCreateTime(now);
  1301. pmBidOpening.setUpdateBy(pmBidOpeningFillReqVo.getUpdateBy());
  1302. pmBidOpening.setUpdateTime(now);
  1303. }
  1304. if (pmBidOpeningService.saveOrUpdateBatch(pmBidOpeningList)) {
  1305. PmDemand pmDemandUpdate = new PmDemand();
  1306. pmDemandUpdate.setDemandId(pmDemand.getDemandId());
  1307. pmDemandUpdate.setProjectStatus(PmProjectStatus.BID_RESULT_ANNOUNCEMENT.getCode());
  1308. pmDemandUpdate.setUpdateTime(now);
  1309. pmDemandUpdate.setUpdateBy(pmBidOpeningFillReqVo.getUpdateBy());
  1310. return this.updateById(pmDemandUpdate);
  1311. } else {
  1312. return false;
  1313. }
  1314. }
  1315. /**
  1316. * 预中标
  1317. *
  1318. * @param pmBidWinningReqVo
  1319. * @return
  1320. * @throws Exception
  1321. */
  1322. @Override
  1323. @Transactional(rollbackFor = Exception.class)
  1324. public boolean insertPmBidWinning(PmBidWinningReqVo pmBidWinningReqVo) throws Exception {
  1325. List<Long> pmBidOpeningIdList = pmBidWinningReqVo.getPmBidOpeningIdList();
  1326. if (ObjectUtils.isEmpty(pmBidWinningReqVo.getBidWinningAmount()) && ObjectUtils.isEmpty(pmBidWinningReqVo.getRemarks())) {
  1327. throw new Exception("中标金额或备注必须填写一个");
  1328. }
  1329. if (ObjectUtils.isEmpty(pmBidOpeningIdList)) {
  1330. throw new Exception("中标单位信息列表不能为空");
  1331. }
  1332. if (ObjectUtils.isEmpty(pmBidWinningReqVo.getSysFileRefs())) {
  1333. throw new Exception("上传附件不能为空");
  1334. }
  1335. PmBidWinning pmBidWinning = new PmBidWinning();
  1336. BeanUtils.copyProperties(pmBidWinningReqVo, pmBidWinning);
  1337. //修改老的中标信息状态
  1338. if (ObjectUtils.isEmpty(pmBidWinningReqVo.getId())) { //属于新增
  1339. LambdaQueryWrapper<PmBidWinning> pmBidWinningLambdaQueryWrapper = new LambdaQueryWrapper<>();
  1340. pmBidWinningLambdaQueryWrapper.eq(PmBidWinning::getDemandId, pmBidWinningReqVo.getDemandId())
  1341. .eq(PmBidWinning::getStatus, BidWinningStatus.NORMAL.getCode());
  1342. List<PmBidWinning> pmBidWinninglist = pmBidWinningService.list(pmBidWinningLambdaQueryWrapper);
  1343. if (!ObjectUtils.isEmpty(pmBidWinninglist)) {
  1344. for (PmBidWinning item : pmBidWinninglist) {
  1345. UpdateWrapper<PmBidWinning> updateWrapper1 = new UpdateWrapper<>();
  1346. updateWrapper1.lambda().set(PmBidWinning::getStatus, BidWinningStatus.BE_REPLACED.getCode())
  1347. .eq(PmBidWinning::getId, item.getId());
  1348. pmBidWinningService.update(updateWrapper1);
  1349. UpdateWrapper<PmBidWinningOpeningRef> updateWrapper2 = new UpdateWrapper<>();
  1350. updateWrapper2.lambda().set(PmBidWinningOpeningRef::getStatus, BidWinningStatus.BE_REPLACED.getCode())
  1351. .eq(PmBidWinningOpeningRef::getWinningId, item.getId())
  1352. .eq(PmBidWinningOpeningRef::getStatus, BidWinningStatus.NORMAL.getCode());
  1353. pmBidWinningOpeningRefService.update(updateWrapper2);
  1354. }
  1355. }
  1356. }
  1357. if (pmBidWinningService.saveOrUpdate(pmBidWinning)) {
  1358. List<PmBidWinningOpeningRef> pmBidWinningOpeningRefList = new ArrayList<>();
  1359. for (Long pmBidOpeningId : pmBidOpeningIdList) {
  1360. LambdaQueryWrapper<PmBidWinningOpeningRef> pmBidWinningOpeningRefLambdaQueryWrapper = new LambdaQueryWrapper<>();
  1361. pmBidWinningOpeningRefLambdaQueryWrapper.eq(PmBidWinningOpeningRef::getOpeningId, pmBidOpeningId)
  1362. .eq(PmBidWinningOpeningRef::getWinningId, pmBidWinning.getId());
  1363. PmBidWinningOpeningRef pmBidWinningOpeningRef = pmBidWinningOpeningRefService.getOne(pmBidWinningOpeningRefLambdaQueryWrapper);
  1364. if (pmBidWinningOpeningRef == null) {
  1365. pmBidWinningOpeningRef = new PmBidWinningOpeningRef();
  1366. pmBidWinningOpeningRef.setCreateBy(pmBidWinningReqVo.getCreateBy());
  1367. pmBidWinningOpeningRef.setCreateTime(pmBidWinningReqVo.getCreateTime());
  1368. }
  1369. pmBidWinningOpeningRef.setDemandId(pmBidWinning.getDemandId());
  1370. pmBidWinningOpeningRef.setOpeningId(pmBidOpeningId);
  1371. pmBidWinningOpeningRef.setWinningId(pmBidWinning.getId());
  1372. pmBidWinningOpeningRef.setUpdateBy(pmBidWinningReqVo.getUpdateBy());
  1373. pmBidWinningOpeningRef.setUpdateTime(pmBidWinningReqVo.getUpdateTime());
  1374. pmBidWinningOpeningRefList.add(pmBidWinningOpeningRef);
  1375. }
  1376. if (pmBidWinningOpeningRefService.saveOrUpdateBatch(pmBidWinningOpeningRefList)) {
  1377. uploadFile(pmBidWinning.getId(), SysFileRefEnum.PM_BID_WINNING_FILE.getType(), pmBidWinningReqVo.getSysFileRefs(), pmBidWinningReqVo.getUpdateBy());
  1378. //发布公告生成后,会默认将该数据同步到公告管理和首页中
  1379. PmDemand pmDemand = this.getById(pmBidWinningReqVo.getDemandId());
  1380. BaseNotice baseNotice = new BaseNotice();
  1381. baseNotice.setName(pmDemand.getProjectName());
  1382. baseNotice.setTitle(pmDemand.getProjectName() + "预中标公告");
  1383. LambdaQueryWrapper<BaseNoticeType> lambdaQueryWrapper = new LambdaQueryWrapper<>();
  1384. lambdaQueryWrapper.eq(BaseNoticeType::getName, "预中标公告");
  1385. BaseNoticeType baseNoticeType = baseNoticeTypeService.getOne(lambdaQueryWrapper);
  1386. if (baseNoticeType == null) {
  1387. throw new Exception("预中标公告 公告类型不存在");
  1388. }
  1389. baseNotice.setDemandId(pmDemand.getDemandId());
  1390. baseNotice.setDeptId(pmDemand.getPurchaseDeptId());
  1391. baseNotice.setIsExcess(pmDemand.getIsExcess());
  1392. baseNotice.setType(baseNoticeType.getId());
  1393. baseNotice.setReleaseTime(pmBidWinningReqVo.getBidAnnouncementTime());
  1394. baseNotice.setCreated(pmBidWinningReqVo.getCreateBy());
  1395. baseNotice.setCreateTime(pmBidWinningReqVo.getCreateTime());
  1396. baseNotice.setUpdated(pmBidWinningReqVo.getUpdateBy());
  1397. baseNotice.setUpdateTime(pmBidWinningReqVo.getUpdateTime());
  1398. this.baseNoticeService.saveOrUpdate(baseNotice);
  1399. PmDemand pmDemandUpdate = new PmDemand();
  1400. pmDemandUpdate.setDemandId(pmBidWinningReqVo.getDemandId());
  1401. pmDemandUpdate.setProjectStatus(PmProjectStatus.POST_BID_QUERY.getCode());
  1402. pmDemandUpdate.setUpdateTime(pmBidWinningReqVo.getUpdateTime());
  1403. pmDemandUpdate.setUpdateBy(pmBidWinningReqVo.getUpdateBy());
  1404. return this.updateById(pmDemandUpdate);
  1405. } else {
  1406. return false;
  1407. }
  1408. } else {
  1409. return false;
  1410. }
  1411. }
  1412. @Override
  1413. @Transactional(rollbackFor = Exception.class)
  1414. public boolean updatePmBidWinning(PmBidWinningReqVo pmBidWinningReqVo) throws Exception {
  1415. List<Long> pmBidOpeningIdList = pmBidWinningReqVo.getPmBidOpeningIdList();
  1416. if (ObjectUtils.isEmpty(pmBidOpeningIdList)) {
  1417. throw new Exception("中标单位信息列表不能为空");
  1418. }
  1419. if (ObjectUtils.isEmpty(pmBidWinningReqVo.getBidWinningAmount())) {
  1420. throw new Exception("中标金额不能为空");
  1421. }
  1422. if (ObjectUtils.isEmpty(pmBidWinningReqVo.getSysFileRefs())) {
  1423. throw new Exception("上传附件不能为空");
  1424. }
  1425. LambdaQueryWrapper<PmBidWinning> lw = new LambdaQueryWrapper<>();
  1426. lw.eq(PmBidWinning::getDemandId, pmBidWinningReqVo.getDemandId()).eq(PmBidWinning::getStatus, BidWinningStatus.NORMAL.getCode());
  1427. List<PmBidWinning> pmBidWinninglist = pmBidWinningService.list(lw);
  1428. if (ObjectUtils.isEmpty(pmBidWinninglist)) {
  1429. throw new Exception("原中标信息不存在");
  1430. }
  1431. //修改老的状态
  1432. for (PmBidWinning item : pmBidWinninglist) {
  1433. UpdateWrapper<PmBidWinning> updateWrapper1 = new UpdateWrapper<>();
  1434. updateWrapper1.lambda().set(PmBidWinning::getStatus, BidWinningStatus.BE_REPLACED.getCode())
  1435. .eq(PmBidWinning::getId, item.getId());
  1436. pmBidWinningService.update(updateWrapper1);
  1437. UpdateWrapper<PmBidWinningOpeningRef> updateWrapper2 = new UpdateWrapper<>();
  1438. updateWrapper2.lambda().set(PmBidWinningOpeningRef::getStatus, BidWinningStatus.BE_REPLACED.getCode())
  1439. .eq(PmBidWinningOpeningRef::getWinningId, item.getId())
  1440. .eq(PmBidWinningOpeningRef::getStatus, BidWinningStatus.NORMAL.getCode());
  1441. pmBidWinningOpeningRefService.update(updateWrapper2);
  1442. }
  1443. //新增
  1444. PmBidWinning pmBidWinning = new PmBidWinning();
  1445. BeanUtils.copyProperties(pmBidWinninglist.get(0), pmBidWinning);
  1446. pmBidWinning.setId(null);
  1447. pmBidWinning.setBidWinningAmount(pmBidWinningReqVo.getBidWinningAmount());
  1448. pmBidWinning.setStatus(BidWinningStatus.NORMAL.getCode());
  1449. pmBidWinning.setUpdateBy(pmBidWinningReqVo.getUpdateBy());
  1450. pmBidWinning.setUpdateTime(pmBidWinningReqVo.getUpdateTime());
  1451. if (pmBidWinningService.save(pmBidWinning)) {
  1452. List<PmBidWinningOpeningRef> pmBidWinningOpeningRefList = new ArrayList<>();
  1453. for (Long pmBidOpeningId : pmBidOpeningIdList) {
  1454. PmBidWinningOpeningRef pmBidWinningOpeningRef = new PmBidWinningOpeningRef();
  1455. pmBidWinningOpeningRef.setDemandId(pmBidWinning.getDemandId());
  1456. pmBidWinningOpeningRef.setOpeningId(pmBidOpeningId);
  1457. pmBidWinningOpeningRef.setWinningId(pmBidWinning.getId());
  1458. pmBidWinningOpeningRef.setStatus(BidWinningStatus.NORMAL.getCode());
  1459. pmBidWinningOpeningRef.setCreateBy(pmBidWinningReqVo.getCreateBy());
  1460. pmBidWinningOpeningRef.setCreateTime(pmBidWinningReqVo.getCreateTime());
  1461. pmBidWinningOpeningRef.setUpdateBy(pmBidWinningReqVo.getUpdateBy());
  1462. pmBidWinningOpeningRef.setUpdateTime(pmBidWinningReqVo.getUpdateTime());
  1463. pmBidWinningOpeningRefList.add(pmBidWinningOpeningRef);
  1464. }
  1465. LambdaQueryWrapper<SysFileRef> sysFileRefLambdaQueryWrapper = new LambdaQueryWrapper<>();
  1466. sysFileRefLambdaQueryWrapper.eq(SysFileRef::getType, SysFileRefEnum.PM_BID_WINNING_FILE.getType())
  1467. .eq(SysFileRef::getRedId, pmBidWinninglist.get(0));
  1468. List<SysFileRef> sysFileRefs = sysFileRefService.list(sysFileRefLambdaQueryWrapper);
  1469. uploadFile(pmBidWinning.getId(), SysFileRefEnum.PM_BID_WINNING_FILE.getType(), sysFileRefs, pmBidWinningReqVo.getUpdateBy());
  1470. return pmBidWinningOpeningRefService.saveBatch(pmBidWinningOpeningRefList);
  1471. } else {
  1472. return false;
  1473. }
  1474. }
  1475. /**
  1476. * 流标
  1477. *
  1478. * @param pmBidFailureReqVo
  1479. * @return
  1480. * @throws Exception
  1481. */
  1482. @Override
  1483. @Transactional(rollbackFor = Exception.class)
  1484. public boolean insertPmBidFailure(PmBidFailureReqVo pmBidFailureReqVo) throws Exception {
  1485. PmBidFailure pmBidFailure = new PmBidFailure();
  1486. BeanUtils.copyProperties(pmBidFailureReqVo, pmBidFailure);
  1487. if (pmBidFailureService.saveOrUpdate(pmBidFailure)) {
  1488. //把中标信息修改状态
  1489. LambdaQueryWrapper<PmBidWinning> lw = new LambdaQueryWrapper<>();
  1490. lw.eq(PmBidWinning::getDemandId, pmBidFailureReqVo.getDemandId()).eq(PmBidWinning::getStatus, BidWinningStatus.NORMAL.getCode());
  1491. List<PmBidWinning> pmBidWinninglist = pmBidWinningService.list(lw);
  1492. if (!ObjectUtils.isEmpty(pmBidWinninglist)) {
  1493. for (PmBidWinning item : pmBidWinninglist) {
  1494. UpdateWrapper<PmBidWinning> updateWrapper1 = new UpdateWrapper<>();
  1495. updateWrapper1.lambda().set(PmBidWinning::getStatus, BidWinningStatus.BE_BID_FAILURE.getCode())
  1496. .eq(PmBidWinning::getId, item.getId());
  1497. pmBidWinningService.update(updateWrapper1);
  1498. UpdateWrapper<PmBidWinningOpeningRef> updateWrapper2 = new UpdateWrapper<>();
  1499. updateWrapper2.lambda().set(PmBidWinningOpeningRef::getStatus, BidWinningStatus.BE_BID_FAILURE.getCode())
  1500. .eq(PmBidWinningOpeningRef::getWinningId, item.getId())
  1501. .eq(PmBidWinningOpeningRef::getStatus, BidWinningStatus.NORMAL.getCode());
  1502. pmBidWinningOpeningRefService.update(updateWrapper2);
  1503. }
  1504. }
  1505. uploadFile(pmBidFailure.getId(), SysFileRefEnum.PM_BID_FAILURE_FILE.getType(), pmBidFailureReqVo.getSysFileRefs(), pmBidFailureReqVo.getUpdateBy());
  1506. //发布公告生成后,会默认将该数据同步到公告管理和首页中
  1507. PmDemand pmDemand = this.getById(pmBidFailureReqVo.getDemandId());
  1508. BaseNotice baseNotice = new BaseNotice();
  1509. baseNotice.setName(pmDemand.getProjectName());
  1510. baseNotice.setTitle(pmDemand.getProjectName() + "流废标公告");
  1511. LambdaQueryWrapper<BaseNoticeType> lambdaQueryWrapper = new LambdaQueryWrapper<>();
  1512. lambdaQueryWrapper.eq(BaseNoticeType::getName, "流废标公告");
  1513. BaseNoticeType baseNoticeType = baseNoticeTypeService.getOne(lambdaQueryWrapper);
  1514. if (baseNoticeType == null) {
  1515. throw new Exception("流废标公告 公告类型不存在");
  1516. }
  1517. baseNotice.setDemandId(pmDemand.getDemandId());
  1518. baseNotice.setDeptId(pmDemand.getPurchaseDeptId());
  1519. baseNotice.setIsExcess(pmDemand.getIsExcess());
  1520. baseNotice.setType(baseNoticeType.getId());
  1521. baseNotice.setReleaseTime(pmBidFailureReqVo.getBidFailureTime());
  1522. baseNotice.setCreated(pmBidFailureReqVo.getCreateBy());
  1523. baseNotice.setCreateTime(pmBidFailureReqVo.getCreateTime());
  1524. baseNotice.setUpdated(pmBidFailureReqVo.getUpdateBy());
  1525. baseNotice.setUpdateTime(pmBidFailureReqVo.getUpdateTime());
  1526. this.baseNoticeService.saveOrUpdate(baseNotice);
  1527. PmDemand pmDemandUpdate = new PmDemand();
  1528. pmDemandUpdate.setDemandId(pmBidFailureReqVo.getDemandId());
  1529. pmDemandUpdate.setProjectStatus(PmProjectStatus.WASTE_BID_HANDLE.getCode());
  1530. pmDemandUpdate.setHasExpert("0");
  1531. pmDemandUpdate.setUpdateTime(pmBidFailureReqVo.getUpdateTime());
  1532. pmDemandUpdate.setUpdateBy(pmBidFailureReqVo.getUpdateBy());
  1533. return this.updateById(pmDemandUpdate);
  1534. } else {
  1535. return false;
  1536. }
  1537. }
  1538. @Override
  1539. @Transactional(rollbackFor = Exception.class)
  1540. public boolean insertContractInfo(PmContractInfoReqVo pmContractInfoReqVo) throws Exception {
  1541. Long demandId = pmContractInfoReqVo.getDemandId();
  1542. if (ObjectUtils.isEmpty(demandId)) {
  1543. throw new Exception("采购需求ID不能为空");
  1544. }
  1545. PmDemand pmDemand = this.getById(demandId);
  1546. if (ObjectUtils.isEmpty(pmDemand)) {
  1547. throw new Exception("采购需求ID错误");
  1548. }
  1549. List<SysFileRef> sysFileRefs = pmContractInfoReqVo.getSysFileRefs();
  1550. if (ObjectUtils.isEmpty(sysFileRefs)) {
  1551. throw new Exception("上传附件不能为空");
  1552. }
  1553. LambdaQueryWrapper<PmContractInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
  1554. lambdaQueryWrapper.eq(PmContractInfo::getDemandId, demandId);
  1555. PmContractInfo pmContractInfo = pmContractInfoService.getOne(lambdaQueryWrapper);
  1556. if (pmContractInfo != null) {
  1557. pmContractInfoReqVo.setId(pmContractInfo.getId());
  1558. BeanUtils.copyProperties(pmContractInfoReqVo, pmContractInfo);
  1559. pmContractInfo.setUpdateTime(pmContractInfoReqVo.getUpdateTime());
  1560. pmContractInfo.setUpdateBy(pmContractInfoReqVo.getUpdateBy());
  1561. } else {
  1562. pmContractInfo = new PmContractInfo();
  1563. BeanUtils.copyProperties(pmContractInfoReqVo, pmContractInfo);
  1564. pmContractInfo.setCreateBy(pmContractInfoReqVo.getCreateBy());
  1565. pmContractInfo.setCreateTime(pmContractInfoReqVo.getCreateTime());
  1566. pmContractInfo.setUpdateTime(pmContractInfoReqVo.getUpdateTime());
  1567. pmContractInfo.setUpdateBy(pmContractInfoReqVo.getUpdateBy());
  1568. }
  1569. if (pmContractInfoService.saveOrUpdate(pmContractInfo)) {
  1570. this.uploadFile(pmContractInfo.getId(), SysFileRefEnum.PM_CONTRACT_INFO.getType(), sysFileRefs, pmContractInfoReqVo.getUpdateBy());
  1571. PmDemand pmDemandUpdate = new PmDemand();
  1572. pmDemandUpdate.setDemandId(demandId);
  1573. pmDemandUpdate.setProjectStatus(PmProjectStatus.UNDER_CONSTRUCTION.getCode());
  1574. pmDemandUpdate.setUpdateTime(pmContractInfoReqVo.getUpdateTime());
  1575. pmDemandUpdate.setUpdateBy(pmContractInfoReqVo.getUpdateBy());
  1576. return this.updateById(pmDemandUpdate);
  1577. } else {
  1578. return false;
  1579. }
  1580. }
  1581. @Override
  1582. @Transactional(rollbackFor = Exception.class)
  1583. public boolean insertProjectConstruction(PmProjectConstructionReqVo pmProjectConstructionReqVo) throws Exception {
  1584. Long demandId = pmProjectConstructionReqVo.getDemandId();
  1585. if (ObjectUtils.isEmpty(demandId)) {
  1586. throw new Exception("采购需求ID不能为空");
  1587. }
  1588. PmDemand pmDemand = this.getById(demandId);
  1589. if (ObjectUtils.isEmpty(pmDemand)) {
  1590. throw new Exception("采购需求ID错误");
  1591. }
  1592. List<SysFileRef> sysFileRefs = pmProjectConstructionReqVo.getSysFileRefs();
  1593. if (ObjectUtils.isEmpty(sysFileRefs)) {
  1594. throw new Exception("上传附件不能为空");
  1595. }
  1596. LambdaQueryWrapper<PmProjectConstruction> lambdaQueryWrapper = new LambdaQueryWrapper<>();
  1597. lambdaQueryWrapper.eq(PmProjectConstruction::getDemandId, demandId);
  1598. PmProjectConstruction pmProjectConstruction = pmProjectConstructionService.getOne(lambdaQueryWrapper);
  1599. if (pmProjectConstruction != null) {
  1600. pmProjectConstructionReqVo.setId(pmProjectConstruction.getId());
  1601. BeanUtils.copyProperties(pmProjectConstructionReqVo, pmProjectConstruction);
  1602. pmProjectConstruction.setUpdateBy(pmProjectConstructionReqVo.getUpdateBy());
  1603. pmProjectConstruction.setUpdateTime(pmProjectConstructionReqVo.getUpdateTime());
  1604. } else {
  1605. pmProjectConstruction = new PmProjectConstruction();
  1606. BeanUtils.copyProperties(pmProjectConstructionReqVo, pmProjectConstruction);
  1607. pmProjectConstruction.setCreateBy(pmProjectConstructionReqVo.getCreateBy());
  1608. pmProjectConstruction.setCreateTime(pmProjectConstructionReqVo.getCreateTime());
  1609. pmProjectConstruction.setUpdateBy(pmProjectConstructionReqVo.getUpdateBy());
  1610. pmProjectConstruction.setUpdateTime(pmProjectConstructionReqVo.getUpdateTime());
  1611. }
  1612. if (pmProjectConstructionService.saveOrUpdate(pmProjectConstruction)) {
  1613. this.uploadFile(pmProjectConstruction.getId(), SysFileRefEnum.PM_PROJECT_CONSTRUCTION.getType(), sysFileRefs, pmProjectConstructionReqVo.getUpdateBy());
  1614. PmDemand pmDemandUpdate = new PmDemand();
  1615. pmDemandUpdate.setDemandId(demandId);
  1616. pmDemandUpdate.setProjectStatus(PmProjectStatus.COMPLETION_CONSTRUCTION.getCode());
  1617. pmDemandUpdate.setRealDeliverTime(pmProjectConstructionReqVo.getUpdateTime());
  1618. pmDemandUpdate.setWarnStatus(WarnStatus.NORMAL.getCode());
  1619. pmDemandUpdate.setUpdateTime(pmProjectConstructionReqVo.getUpdateTime());
  1620. pmDemandUpdate.setUpdateBy(pmProjectConstructionReqVo.getUpdateBy());
  1621. return this.updateById(pmDemandUpdate);
  1622. } else {
  1623. return false;
  1624. }
  1625. }
  1626. /**
  1627. * 更新需求预警状态
  1628. *
  1629. * @param demnadId
  1630. * @return
  1631. */
  1632. @Override
  1633. @Transactional(rollbackFor = Exception.class)
  1634. public void updateDemandWarnStatus(Long demnadId) {
  1635. PmDemand pmDemand = this.getById(demnadId);
  1636. List<SysDictData> data = iSysDictTypeService.selectDictDataByType("alert_time_setting");
  1637. int setting1 = Integer.parseInt(data.stream().filter(item -> item.getDictLabel().equals("计划提报时间")).collect(Collectors.toList()).get(0).getDictValue());
  1638. log.info("******** setting1 == " + setting1);
  1639. //需求提报时间:根据数据阈值中设置的提报时间进行判断,进行预警
  1640. int diff1 = DateUtils.differentDaysByMillisecond(pmDemand.getPlanDemandSubTime(), DateUtils.parseDate(DateUtils.getDate()));
  1641. if (ObjectUtils.isEmpty(pmDemand.getRealDemandCommitTime()) && diff1 > 0 && diff1 <= setting1) {
  1642. PmDemand pmDemandUpdate = new PmDemand();
  1643. pmDemandUpdate.setDemandId(demnadId);
  1644. pmDemandUpdate.setWarnStatus(WarnStatus.DEMAND_COMMT_WARNING.getCode());
  1645. this.updateById(pmDemandUpdate);
  1646. }
  1647. }
  1648. /**
  1649. * 通过需求ID列表 查询采购执行列表 sunhh
  1650. *
  1651. * @param demandIdList
  1652. * @return
  1653. */
  1654. @Override
  1655. public List<PmDemand> selectByDemandIdList(List<Integer> demandIdList) {
  1656. return this.baseMapper.selectByDemandIdList(demandIdList);
  1657. }
  1658. /**
  1659. * 专家库--查询抽取专家列表 非必传条件:专家名称,开始结束时间 sunhh
  1660. *
  1661. * @param baseExpertVo
  1662. * @return
  1663. */
  1664. @Override
  1665. public List<PmDemand> selectExtractionExpert(BaseExpertVo baseExpertVo) {
  1666. return pmDemandMapper.selectExtractionExpert(baseExpertVo);
  1667. }
  1668. @Override
  1669. public List<PmDemand> demandWaitCommit() {
  1670. List<PmDemand> byStatus = getListByStatus(PmProjectStatus.DEMAND_WAIT_FILL.getCode());
  1671. byStatus.addAll(getListByStatus(PmProjectStatus.DEMAND_WAIT_COMMIT.getCode()));
  1672. return (byStatus);
  1673. }
  1674. @Override
  1675. public List<PmDemand> contractWaitFilled() {
  1676. List<PmDemand> byStatus = getListByStatus(PmProjectStatus.CONTRACT_WAIT_FILL.getCode());
  1677. return (byStatus);
  1678. }
  1679. @Override
  1680. public List<PmDemand> projectWaitFinish() {
  1681. List<PmDemand> byStatus = getListByStatus(PmProjectStatus.UNDER_CONSTRUCTION.getCode());
  1682. return (byStatus);
  1683. }
  1684. @Override
  1685. public List<PmDemand> demandWaitExamine() {
  1686. return getListByStatus(PmProjectStatus.DEMAND_WAIT_AUDIT.getCode());
  1687. }
  1688. @Override
  1689. public List<PmDemand> taskWaitRelease() {
  1690. return getListByStatus(PmProjectStatus.TASK_WAIT_RELEASE.getCode());
  1691. }
  1692. @Override
  1693. public List<PmDemandResVo> purchaseDemandDocking() {
  1694. List<PmDemand> byStatus = getListByStatusCGB(PmProjectStatus.PURCHASE_DEMAND_DOCKING.getCode());
  1695. return listToVoList(byStatus);
  1696. }
  1697. @Override
  1698. public List<PmDemandResVo> expertFeedback() {
  1699. List<PmDemand> byStatus = getListByStatusCGB(PmProjectStatus.EXPERT_FEEDBACK.getCode());
  1700. return listToVoList(byStatus);
  1701. }
  1702. @Override
  1703. public List<PmDemandResVo> procurementDocumentsReview() {
  1704. List<PmDemand> byStatus = getListByStatusCGB(PmProjectStatus.PROCUREMENT_DOCUMENTS_REVIEW.getCode());
  1705. return listToVoList(byStatus);
  1706. }
  1707. @Override
  1708. public List<PmDemandResVo> procurementAnnouncement() {
  1709. List<PmDemand> byStatus = getListByStatusCGB(PmProjectStatus.PROCUREMENT_ANNOUNCEMENT.getCode());
  1710. return listToVoList(byStatus);
  1711. }
  1712. @Override
  1713. public List<PmDemandResVo> preBidQuery() {
  1714. List<PmDemand> byStatus = getListByStatusCGB(PmProjectStatus.PRE_BID_QUERY.getCode());
  1715. return listToVoList(byStatus);
  1716. }
  1717. @Override
  1718. public List<PmDemandResVo> waitOpenBid() {
  1719. List<PmDemand> byStatus = getListByStatusCGB(PmProjectStatus.WAIT_OPEN_BID.getCode());
  1720. return listToVoList(byStatus);
  1721. }
  1722. @Override
  1723. public List<PmDemandResVo> bidResultAnnouncement() {
  1724. List<PmDemand> byStatus = getListByStatusCGB(PmProjectStatus.BID_RESULT_ANNOUNCEMENT.getCode());
  1725. return listToVoList(byStatus);
  1726. }
  1727. @Override
  1728. public List<PmDemandResVo> wasteBidHandle() {
  1729. List<PmDemand> byStatus = getListByStatusCGB(PmProjectStatus.WASTE_BID_HANDLE.getCode());
  1730. return listToVoList(byStatus);
  1731. }
  1732. @Override
  1733. public List<PmDemandResVo> postBidQuery() {
  1734. List<PmDemand> byStatus = getListByStatusCGB(PmProjectStatus.POST_BID_QUERY.getCode());
  1735. return listToVoList(byStatus);
  1736. }
  1737. @Override
  1738. public AjaxResult procurementOfficeWillManipulateTotal() {
  1739. List<HomeToDoQueryResVo> homeRes = new ArrayList<>();
  1740. // 采购需求对接,专家意见反馈,采购文件编制审核,采购公告发布,标前质疑投诉,待开标,评标结果公告,流废标处置,标后质疑
  1741. List<PmDemandResVo> demandRes = new ArrayList<>();
  1742. List<String> projectStatus = new ArrayList<>();
  1743. projectStatus.add(PmProjectStatus.PURCHASE_DEMAND_DOCKING.getCode());
  1744. projectStatus.add(PmProjectStatus.EXPERT_FEEDBACK.getCode());
  1745. projectStatus.add(PmProjectStatus.PROCUREMENT_DOCUMENTS_REVIEW.getCode());
  1746. projectStatus.add(PmProjectStatus.PROCUREMENT_ANNOUNCEMENT.getCode());
  1747. projectStatus.add(PmProjectStatus.PRE_BID_QUERY.getCode());
  1748. projectStatus.add(PmProjectStatus.WAIT_OPEN_BID.getCode());
  1749. projectStatus.add(PmProjectStatus.BID_RESULT_ANNOUNCEMENT.getCode());
  1750. projectStatus.add(PmProjectStatus.WASTE_BID_HANDLE.getCode());
  1751. projectStatus.add(PmProjectStatus.POST_BID_QUERY.getCode());
  1752. demandRes = listToVoList(getListByStatusTotalCGB(projectStatus));
  1753. //计划数据--发函催告
  1754. List<PlanQuarterResponseVo> planRes = planYearsService.willSendLetter();
  1755. //转为首页table展示数据
  1756. if (!ObjectUtils.isEmpty(demandRes) && demandRes.size() > 0) {
  1757. for (PmDemandResVo demandResVo : demandRes) {
  1758. HomeToDoQueryResVo home = new HomeToDoQueryResVo();
  1759. home.setEvaluation(BigDecimal.valueOf(demandResVo.getEvaluation()));
  1760. BeanUtils.copyProperties(demandResVo, home);
  1761. homeRes.add(home);
  1762. }
  1763. }
  1764. if (!ObjectUtils.isEmpty(planRes) && planRes.size() > 0) {
  1765. for (PlanQuarterResponseVo planVo : planRes) {
  1766. HomeToDoQueryResVo home = new HomeToDoQueryResVo();
  1767. BeanUtils.copyProperties(planVo, home);
  1768. homeRes.add(home);
  1769. }
  1770. }
  1771. return AjaxResult.success(homeRes);
  1772. }
  1773. @Override
  1774. public AjaxResult procurementOfficeWillManipulateTotalNum() {
  1775. List<StatisticalChartsResVo> result = new ArrayList<>();
  1776. // 采购需求对接,专家意见反馈,采购文件编制审核,采购公告发布,标前质疑投诉,待开标,评标结果公告,流废标处置,标后质疑
  1777. Integer numByStatus = getNumByStatusCGB(PmProjectStatus.PURCHASE_DEMAND_DOCKING.getCode());
  1778. StatisticalChartsResVo chartsResVo = new StatisticalChartsResVo();
  1779. chartsResVo.setNum(numByStatus);
  1780. chartsResVo.setColumnName("采购需求对接");
  1781. result.add(chartsResVo);
  1782. Integer numByStatus1 = getNumByStatusCGB(PmProjectStatus.EXPERT_FEEDBACK.getCode());
  1783. StatisticalChartsResVo chartsResVo1 = new StatisticalChartsResVo();
  1784. chartsResVo1.setColumnName("专家意见反馈");
  1785. chartsResVo1.setNum(numByStatus1);
  1786. result.add(chartsResVo1);
  1787. Integer numByStatus2 = getNumByStatusCGB(PmProjectStatus.PROCUREMENT_DOCUMENTS_REVIEW.getCode());
  1788. StatisticalChartsResVo chartsResVo2 = new StatisticalChartsResVo();
  1789. chartsResVo2.setColumnName("采购文件编制审核");
  1790. chartsResVo2.setNum(numByStatus2);
  1791. result.add(chartsResVo2);
  1792. Integer numByStatus3 = getNumByStatusCGB(PmProjectStatus.PROCUREMENT_ANNOUNCEMENT.getCode());
  1793. StatisticalChartsResVo chartsResVo3 = new StatisticalChartsResVo();
  1794. chartsResVo3.setColumnName("采购公告发布");
  1795. chartsResVo3.setNum(numByStatus3);
  1796. result.add(chartsResVo3);
  1797. Integer numByStatus4 = getNumByStatusCGB(PmProjectStatus.PRE_BID_QUERY.getCode());
  1798. StatisticalChartsResVo chartsResVo4 = new StatisticalChartsResVo();
  1799. chartsResVo4.setColumnName("标前质疑投诉");
  1800. chartsResVo4.setNum(numByStatus4);
  1801. result.add(chartsResVo4);
  1802. Integer numByStatus5 = getNumByStatusCGB(PmProjectStatus.WAIT_OPEN_BID.getCode());
  1803. StatisticalChartsResVo chartsResVo5 = new StatisticalChartsResVo();
  1804. chartsResVo5.setColumnName("待开标");
  1805. chartsResVo5.setNum(numByStatus5);
  1806. result.add(chartsResVo5);
  1807. Integer numByStatus6 = getNumByStatusCGB(PmProjectStatus.BID_RESULT_ANNOUNCEMENT.getCode());
  1808. StatisticalChartsResVo chartsResVo6 = new StatisticalChartsResVo();
  1809. chartsResVo6.setColumnName("评标结果公告");
  1810. chartsResVo6.setNum(numByStatus6);
  1811. result.add(chartsResVo6);
  1812. Integer numByStatus7 = getNumByStatusCGB(PmProjectStatus.WASTE_BID_HANDLE.getCode());
  1813. StatisticalChartsResVo chartsResVo7 = new StatisticalChartsResVo();
  1814. chartsResVo7.setColumnName("流废标处置");
  1815. chartsResVo7.setNum(numByStatus7);
  1816. result.add(chartsResVo7);
  1817. Integer numByStatus8 = getNumByStatusCGB(PmProjectStatus.POST_BID_QUERY.getCode());
  1818. StatisticalChartsResVo chartsResVo8 = new StatisticalChartsResVo();
  1819. chartsResVo8.setColumnName("标后质疑");
  1820. chartsResVo8.setNum(numByStatus8);
  1821. result.add(chartsResVo8);
  1822. //计划数据--发函催告
  1823. Integer letterNum = planYearsService.willSendLetterNum();
  1824. StatisticalChartsResVo chartsResVo9 = new StatisticalChartsResVo();
  1825. chartsResVo9.setColumnName("发函催告");
  1826. chartsResVo9.setNum(letterNum);
  1827. result.add(chartsResVo9);
  1828. StatisticalChartsResVo chartsResVoT = new StatisticalChartsResVo();
  1829. chartsResVoT.setColumnName("全部");
  1830. chartsResVoT.setNum(willTotal(result));
  1831. result.add(chartsResVoT);
  1832. return AjaxResult.success(result);
  1833. }
  1834. public Integer willTotal(List<StatisticalChartsResVo> result) {
  1835. Integer re = 0;
  1836. if (!ObjectUtils.isEmpty(result)) {
  1837. for (StatisticalChartsResVo resVo : result) {
  1838. re += resVo.getNum();
  1839. }
  1840. }
  1841. return re;
  1842. }
  1843. /**
  1844. * 统计分析-采购项目信息统计
  1845. *
  1846. * @param pmDemandReqVo
  1847. * @return
  1848. */
  1849. @Override
  1850. public Map<String, Integer> purchaseProjectStatistical(PmDemandReqVo pmDemandReqVo) {
  1851. //是-1就是查询自己及子孙级以下,否则只查询指定部门
  1852. pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId()));
  1853. Map<String, Integer> mapReturn = new HashMap<>();
  1854. // 查询项目总数量
  1855. Map<String, Integer> mapCount = pmDemandMapper.purchaseProjectStatistical(pmDemandReqVo);
  1856. // 查询已完成项目数量,预算(合同)金额数量
  1857. Map<String, Integer> mapYWC = pmDemandMapper.purchaseProjectStatisticalYWC(pmDemandReqVo);
  1858. // 查询新创建项目数量,预算金额数量
  1859. Map<String, Integer> mapXCJ = pmDemandMapper.purchaseProjectStatisticalXCJ(pmDemandReqVo);
  1860. // 查询去年完成项目数量,预算(合同)金额数量
  1861. Map<String, Integer> mapQNWC = pmDemandMapper.purchaseProjectStatisticalQNWC(pmDemandReqVo);
  1862. mapReturn.putAll(mapCount);
  1863. mapReturn.putAll(mapYWC);
  1864. mapReturn.putAll(mapXCJ);
  1865. mapReturn.putAll(mapQNWC);
  1866. return mapReturn;
  1867. }
  1868. @Override
  1869. public List<StatisticalChartsResVo> countByProjectAttr(PmDemandReqVo pmDemandReqVo) {
  1870. //是-1就是查询自己及子孙级以下,否则只查询指定部门
  1871. if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) {
  1872. pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId()));
  1873. } else {
  1874. pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId()));
  1875. }
  1876. List<StatisticalChartsResVo> resVos = new ArrayList<>();
  1877. //直接获取每个属性的数量
  1878. //重点采购项目
  1879. pmDemandReqVo.setProjectAttr(ProjectAttribute.emergency.getCode());
  1880. StatisticalChartsResVo vo1 = pmDemandMapper.countByProjectAttr(pmDemandReqVo);
  1881. vo1.setColumnName("重点采购项目");
  1882. resVos.add(vo1);
  1883. //重大规划任务项目
  1884. pmDemandReqVo.setProjectAttr(ProjectAttribute.majorPlan.getCode());
  1885. StatisticalChartsResVo vo2 = pmDemandMapper.countByProjectAttr(pmDemandReqVo);
  1886. vo2.setColumnName("重大规划任务项目");
  1887. resVos.add(vo2);
  1888. //规划任务项目
  1889. pmDemandReqVo.setProjectAttr(ProjectAttribute.plan.getCode());
  1890. StatisticalChartsResVo vo3 = pmDemandMapper.countByProjectAttr(pmDemandReqVo);
  1891. vo3.setColumnName("规划任务项目");
  1892. resVos.add(vo3);
  1893. //一般采购项目
  1894. pmDemandReqVo.setProjectAttr(ProjectAttribute.commonly.getCode());
  1895. StatisticalChartsResVo vo4 = pmDemandMapper.countByProjectAttr(pmDemandReqVo);
  1896. vo4.setColumnName("一般采购项目");
  1897. resVos.add(vo4);
  1898. return resVos;
  1899. }
  1900. @Override
  1901. public List<StatisticalChartsResVo> countByTaskAttr(PmDemandReqVo pmDemandReqVo) {
  1902. //是-1就是查询自己及子孙级以下,否则只查询指定部门
  1903. if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) {
  1904. pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId()));
  1905. } else {
  1906. pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId()));
  1907. }
  1908. //状态为“任务待下达”以后的数据
  1909. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.TASK_WAIT_RELEASE.getCode()));
  1910. List<StatisticalChartsResVo> resVos = new ArrayList<>();
  1911. //重点采购项目
  1912. pmDemandReqVo.setProjectAttr(ProjectAttribute.emergency.getCode());
  1913. StatisticalChartsResVo vo1 = pmDemandMapper.countByTaskAttr(pmDemandReqVo);
  1914. vo1.setColumnName("重点采购项目");
  1915. resVos.add(vo1);
  1916. //重大规划任务项目
  1917. pmDemandReqVo.setProjectAttr(ProjectAttribute.majorPlan.getCode());
  1918. StatisticalChartsResVo vo2 = pmDemandMapper.countByTaskAttr(pmDemandReqVo);
  1919. vo2.setColumnName("重大规划任务项目");
  1920. resVos.add(vo2);
  1921. //规划任务项目
  1922. pmDemandReqVo.setProjectAttr(ProjectAttribute.plan.getCode());
  1923. StatisticalChartsResVo vo3 = pmDemandMapper.countByTaskAttr(pmDemandReqVo);
  1924. vo3.setColumnName("规划任务项目");
  1925. resVos.add(vo3);
  1926. //一般采购项目
  1927. pmDemandReqVo.setProjectAttr(ProjectAttribute.commonly.getCode());
  1928. StatisticalChartsResVo vo4 = pmDemandMapper.countByTaskAttr(pmDemandReqVo);
  1929. vo4.setColumnName("一般采购项目");
  1930. resVos.add(vo4);
  1931. return resVos;
  1932. }
  1933. @Override
  1934. public List<StatisticalChartsResVo> countByPurchaseMode(PmDemandReqVo pmDemandReqVo) {
  1935. //是-1就是查询自己及子孙级以下,否则只查询指定部门
  1936. if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) {
  1937. pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId()));
  1938. } else {
  1939. pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId()));
  1940. }
  1941. //状态为“任务待下达”以后的数据
  1942. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.TASK_WAIT_RELEASE.getCode()));
  1943. List<StatisticalChartsResVo> resVos = new ArrayList<>();
  1944. //公开招标
  1945. pmDemandReqVo.setPurchaseMode(ProcurementMethodSuggest.OPEN_BIDDING.getCode());
  1946. StatisticalChartsResVo chartsR = pmDemandMapper.countByPurchaseMode(pmDemandReqVo);
  1947. chartsR.setColumnName("公开招标");
  1948. resVos.add(chartsR);
  1949. //邀请招标
  1950. pmDemandReqVo.setPurchaseMode(ProcurementMethodSuggest.SELECTED_BIDDING.getCode());
  1951. StatisticalChartsResVo chartsR1 = pmDemandMapper.countByPurchaseMode(pmDemandReqVo);
  1952. chartsR1.setColumnName("邀请招标");
  1953. resVos.add(chartsR1);
  1954. //竞争性谈判
  1955. pmDemandReqVo.setPurchaseMode(ProcurementMethodSuggest.COMPETITIVE_NEGOTIATION.getCode());
  1956. StatisticalChartsResVo chartsR2 = pmDemandMapper.countByPurchaseMode(pmDemandReqVo);
  1957. chartsR2.setColumnName("竞争性谈判");
  1958. resVos.add(chartsR2);
  1959. //询价
  1960. pmDemandReqVo.setPurchaseMode(ProcurementMethodSuggest.ENQUIRY.getCode());
  1961. StatisticalChartsResVo chartsR3 = pmDemandMapper.countByPurchaseMode(pmDemandReqVo);
  1962. chartsR3.setColumnName("询价");
  1963. resVos.add(chartsR3);
  1964. //单一来源
  1965. pmDemandReqVo.setPurchaseMode(ProcurementMethodSuggest.SINGLE_SOURCE.getCode());
  1966. StatisticalChartsResVo chartsR4 = pmDemandMapper.countByPurchaseMode(pmDemandReqVo);
  1967. chartsR4.setColumnName("单一来源");
  1968. resVos.add(chartsR4);
  1969. return resVos;
  1970. }
  1971. @Override
  1972. public List<StatisticalChartsResVo> countByEvaluation(PmDemandReqVo pmDemandReqVo) {
  1973. //是-1就是查询自己及子孙级以下,否则只查询指定部门
  1974. if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) {
  1975. pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId()));
  1976. } else {
  1977. pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId()));
  1978. }
  1979. //状态为“任务待下达”以后的数据
  1980. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.TASK_WAIT_RELEASE.getCode()));
  1981. List<StatisticalChartsResVo> resVos = new ArrayList<>();
  1982. //概算金额包括:100万以下采购任务、100至500万元采购任务、500至1000万元采购任务、1000至5000万元采购任务、5000至1亿元采购任务、1亿元及以上采购任务
  1983. pmDemandReqVo.setEvaluation(100);
  1984. StatisticalChartsResVo resVo = pmDemandMapper.countByEvaluationLt(pmDemandReqVo);
  1985. resVo.setColumnName("100万以下采购任务");
  1986. resVos.add(resVo);
  1987. pmDemandReqVo.setEvaluation(100);
  1988. pmDemandReqVo.setEvaluationEnd(500);
  1989. StatisticalChartsResVo resVo1 = pmDemandMapper.countByEvaluationBet(pmDemandReqVo);
  1990. resVo1.setColumnName("100至500万元采购任务");
  1991. resVos.add(resVo1);
  1992. pmDemandReqVo.setEvaluation(500);
  1993. pmDemandReqVo.setEvaluationEnd(1000);
  1994. StatisticalChartsResVo resVo2 = pmDemandMapper.countByEvaluationBet(pmDemandReqVo);
  1995. resVo2.setColumnName("500至1000万元采购任务");
  1996. resVos.add(resVo2);
  1997. pmDemandReqVo.setEvaluation(1000);
  1998. pmDemandReqVo.setEvaluationEnd(5000);
  1999. StatisticalChartsResVo resVo3 = pmDemandMapper.countByEvaluationBet(pmDemandReqVo);
  2000. resVo3.setColumnName("1000至5000万元采购任务");
  2001. resVos.add(resVo3);
  2002. pmDemandReqVo.setEvaluation(5000);
  2003. pmDemandReqVo.setEvaluationEnd(10000);
  2004. StatisticalChartsResVo resVo4 = pmDemandMapper.countByEvaluationBet(pmDemandReqVo);
  2005. resVo4.setColumnName("5000至1亿元采购任务");
  2006. resVos.add(resVo4);
  2007. pmDemandReqVo.setEvaluation(10000);
  2008. StatisticalChartsResVo resVo5 = pmDemandMapper.countByEvaluationGt(pmDemandReqVo);
  2009. resVo5.setColumnName("1亿元及以上采购任务");
  2010. resVos.add(resVo5);
  2011. return resVos;
  2012. }
  2013. @Override
  2014. public AjaxResult countProjectExceed(PmDemandReqVo pmDemandReqVo) {
  2015. //是-1就是查询自己及子孙级以下,否则只查询指定部门
  2016. if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) {
  2017. pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId()));
  2018. } else {
  2019. pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId()));
  2020. }
  2021. List<StatisticalChartsResVo> resVos = new ArrayList<>();
  2022. //执行滞后采购项目:本年度所有的逾期项目数
  2023. //预算金额:本年度所有逾期项目累加的预算金额
  2024. StatisticalChartsResVo resVo = pmDemandMapper.countProjectExceedThisYear(pmDemandReqVo);
  2025. resVo.setColumnName("本年度执行滞后任务");
  2026. resVo.setColumnNamePlus("任务新增数量");
  2027. resVos.add(resVo);
  2028. StatisticalChartsResVo resVo2 = pmDemandMapper.countProjectExceedThisQua(pmDemandReqVo);
  2029. resVo2.setColumnName("本季度执行滞后任务");
  2030. resVo2.setColumnNamePlus("任务新增数量");
  2031. resVos.add(resVo2);
  2032. StatisticalChartsResVo resVo3 = pmDemandMapper.countProjectExceedThisMonth(pmDemandReqVo);
  2033. resVo3.setColumnName("本月执行滞后任务");
  2034. resVo3.setColumnNamePlus("任务新增数量");
  2035. resVos.add(resVo3);
  2036. StatisticalChartsResVo resVo4 = pmDemandMapper.countProjectExceedAllNum(pmDemandReqVo);
  2037. resVo4.setColumnName("累计执行滞后采购任务");
  2038. resVo4.setColumnNamePlus("采购任务数量");
  2039. resVos.add(resVo4);
  2040. //执行停滞采购任务数量--退回的采购任务数量
  2041. List<String> tzrw = new ArrayList<>();
  2042. tzrw.add(PmProjectStatus.DEMAND_AUDIT_RETURN.getCode());
  2043. pmDemandReqVo.setProjectStatusList(tzrw);
  2044. Map<String, Object> map = pmDemandMapper.purchaseProjectDistribution(pmDemandReqVo);
  2045. StatisticalChartsResVo resVo5 = new StatisticalChartsResVo();
  2046. resVo5.setColumnName("执行停滞");
  2047. resVo5.setColumnNamePlus("采购任务数量");
  2048. resVo5.setNum(Math.toIntExact((Long) map.get("countNumber")));
  2049. resVo5.setEvaluationTotal((BigDecimal) map.get("evaluationTotal"));
  2050. resVos.add(resVo5);
  2051. return AjaxResult.success(resVos);
  2052. }
  2053. /**
  2054. * 统计不同时间维度的逾期项目
  2055. *
  2056. * @return
  2057. */
  2058. @Override
  2059. public AjaxResult exceedAnalysis(PmDemandReqVo pmDemandReqVo) {
  2060. //是-1就是查询自己及子孙级以下,否则只查询指定部门
  2061. pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId()));
  2062. HashMap<String, List<StatisticalChartsResVo>> resMap = new HashMap<>();
  2063. List<StatisticalChartsResVo> byYear = pmDemandMapper.countProjectExceedYear(pmDemandReqVo);
  2064. if (pmDemandReqVo.getTimeType().equals("1")) {
  2065. resMap.put("年", byYear);
  2066. } else if (pmDemandReqVo.getTimeType().equals("2")) {
  2067. List<StatisticalChartsResVo> byQuarter = new LinkedList<>();
  2068. for (StatisticalChartsResVo chartsResVo : byYear) {
  2069. pmDemandReqVo.setYear(Integer.parseInt(chartsResVo.getColumnName()));
  2070. for (int i = 1; i <= 4; i++) {
  2071. pmDemandReqVo.setQuarter(i);
  2072. StatisticalChartsResVo quarter = pmDemandMapper.countProjectExceedQuarter(pmDemandReqVo);
  2073. if (ObjectUtils.isEmpty(quarter)) {
  2074. StatisticalChartsResVo vo = new StatisticalChartsResVo("", "", 0, BigDecimal.valueOf(0), BigDecimal.valueOf(0));
  2075. quarter = vo;
  2076. quarter.setColumnName(chartsResVo.getColumnName() + "年第" + i + "季度");
  2077. }
  2078. quarter.setColumnName(chartsResVo.getColumnName() + "年第" + i + "季度");
  2079. byQuarter.add(quarter);
  2080. }
  2081. }
  2082. resMap.put("季度", byQuarter);
  2083. } else if (pmDemandReqVo.getTimeType().equals("3")) {
  2084. List<StatisticalChartsResVo> byMonth = new LinkedList<>();
  2085. for (StatisticalChartsResVo chartsResVo : byYear) {
  2086. pmDemandReqVo.setYear(Integer.parseInt(chartsResVo.getColumnName()));
  2087. for (int i = 1; i <= 12; i++) {
  2088. pmDemandReqVo.setMonth(i);
  2089. StatisticalChartsResVo month = pmDemandMapper.countProjectExceedMonth(pmDemandReqVo);
  2090. if (ObjectUtils.isEmpty(month)) {
  2091. StatisticalChartsResVo vo = new StatisticalChartsResVo("", "", 0, BigDecimal.valueOf(0), BigDecimal.valueOf(0));
  2092. month = vo;
  2093. month.setColumnName(chartsResVo.getColumnName() + "年" + i + "月");
  2094. }
  2095. month.setColumnName(chartsResVo.getColumnName() + "年" + i + "月");
  2096. byMonth.add(month);
  2097. }
  2098. }
  2099. resMap.put("月", byMonth);
  2100. }
  2101. return AjaxResult.success(resMap);
  2102. }
  2103. @Override
  2104. public AjaxResult taskQuantityAnalysis(PmDemandReqVo pmDemandReqVo) {
  2105. //是-1就是查询自己及子孙级以下,否则只查询指定部门
  2106. pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId()));
  2107. HashMap<String, List<StatisticalChartsResVo>> resMap = new HashMap<>();
  2108. //任务数量趋势分析:按照月、季度、年统计“项目属性”字段中“重大规划”属性的项目
  2109. List<StatisticalChartsResVo> byYear = pmDemandMapper.countProjectMajorByYear(pmDemandReqVo);
  2110. if (pmDemandReqVo.getTimeType().equals("1")) {
  2111. resMap.put("年", byYear);
  2112. } else if (pmDemandReqVo.getTimeType().equals("2")) {
  2113. List<StatisticalChartsResVo> byQuarter = new LinkedList<>();
  2114. for (StatisticalChartsResVo chartsResVo : byYear) {
  2115. pmDemandReqVo.setYear(Integer.parseInt(chartsResVo.getColumnName()));
  2116. for (int i = 1; i <= 4; i++) {
  2117. pmDemandReqVo.setQuarter(i);
  2118. StatisticalChartsResVo quarter = pmDemandMapper.countProjectMajorByQuarter(pmDemandReqVo);
  2119. quarter.setColumnName(chartsResVo.getColumnName() + "年第" + i + "季度");
  2120. byQuarter.add(quarter);
  2121. }
  2122. }
  2123. resMap.put("季度", byQuarter);
  2124. } else if (pmDemandReqVo.getTimeType().equals("3")) {
  2125. List<StatisticalChartsResVo> byMonth = pmDemandMapper.countProjectMajorByMonth(pmDemandReqVo);
  2126. resMap.put("月", byMonth);
  2127. }
  2128. return AjaxResult.success(resMap);
  2129. }
  2130. @Override
  2131. public AjaxResult countEveryStatusNum(PmDemandReqVo pmDemandReqVo) {
  2132. //阶段包括:采购需求对接,专家意见反馈,采购文件编制审核,采购公告发布,标前质疑投诉,待开标,评标结果公告,流废标处置,标后质疑
  2133. //是-1就是查询自己及子孙级以下,否则只查询指定部门
  2134. if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) {
  2135. pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId()));
  2136. } else {
  2137. pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId()));
  2138. }
  2139. List<StatisticalChartsResVo> everyStatusNum = new ArrayList<>();
  2140. //项目进行到各个阶段的数量
  2141. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.PURCHASE_DEMAND_DOCKING.getCode()));
  2142. StatisticalChartsResVo everyStatusNum9 = pmDemandMapper.countEveryStatusNum(pmDemandReqVo);
  2143. everyStatusNum9.setColumnName(PmProjectStatus.PURCHASE_DEMAND_DOCKING.getInfo());
  2144. everyStatusNum.add(everyStatusNum9);
  2145. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.EXPERT_FEEDBACK.getCode()));
  2146. StatisticalChartsResVo everyStatusNum10 = pmDemandMapper.countEveryStatusNum(pmDemandReqVo);
  2147. everyStatusNum10.setColumnName(PmProjectStatus.EXPERT_FEEDBACK.getInfo());
  2148. everyStatusNum.add(everyStatusNum10);
  2149. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.PROCUREMENT_DOCUMENTS_REVIEW.getCode()));
  2150. StatisticalChartsResVo everyStatusNum11 = pmDemandMapper.countEveryStatusNum(pmDemandReqVo);
  2151. everyStatusNum11.setColumnName(PmProjectStatus.PROCUREMENT_DOCUMENTS_REVIEW.getInfo());
  2152. everyStatusNum.add(everyStatusNum11);
  2153. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.PROCUREMENT_ANNOUNCEMENT.getCode()));
  2154. StatisticalChartsResVo everyStatusNum12 = pmDemandMapper.countEveryStatusNum(pmDemandReqVo);
  2155. everyStatusNum12.setColumnName(PmProjectStatus.PROCUREMENT_ANNOUNCEMENT.getInfo());
  2156. everyStatusNum.add(everyStatusNum12);
  2157. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.PRE_BID_QUERY.getCode()));
  2158. StatisticalChartsResVo everyStatusNum13 = pmDemandMapper.countEveryStatusNum(pmDemandReqVo);
  2159. everyStatusNum13.setColumnName(PmProjectStatus.PRE_BID_QUERY.getInfo());
  2160. everyStatusNum.add(everyStatusNum13);
  2161. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.WAIT_OPEN_BID.getCode()));
  2162. StatisticalChartsResVo everyStatusNum14 = pmDemandMapper.countEveryStatusNum(pmDemandReqVo);
  2163. everyStatusNum14.setColumnName(PmProjectStatus.WAIT_OPEN_BID.getInfo());
  2164. everyStatusNum.add(everyStatusNum14);
  2165. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.BID_RESULT_ANNOUNCEMENT.getCode()));
  2166. StatisticalChartsResVo everyStatusNum15 = pmDemandMapper.countEveryStatusNum(pmDemandReqVo);
  2167. everyStatusNum15.setColumnName(PmProjectStatus.BID_RESULT_ANNOUNCEMENT.getInfo());
  2168. everyStatusNum.add(everyStatusNum15);
  2169. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.WASTE_BID_HANDLE.getCode()));
  2170. StatisticalChartsResVo everyStatusNum16 = pmDemandMapper.countEveryStatusNum(pmDemandReqVo);
  2171. everyStatusNum16.setColumnName(PmProjectStatus.WASTE_BID_HANDLE.getInfo());
  2172. everyStatusNum.add(everyStatusNum16);
  2173. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.POST_BID_QUERY.getCode()));
  2174. StatisticalChartsResVo everyStatusNum17 = pmDemandMapper.countEveryStatusNum(pmDemandReqVo);
  2175. everyStatusNum17.setColumnName(PmProjectStatus.POST_BID_QUERY.getInfo());
  2176. everyStatusNum.add(everyStatusNum17);
  2177. return AjaxResult.success(everyStatusNum);
  2178. }
  2179. @Override
  2180. public AjaxResult exceedMarketAnalysis(PmDemandReqVo pmDemandReqVo) {
  2181. //是-1就是查询自己及子孙级以下,否则只查询指定部门
  2182. if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) {
  2183. pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId()));
  2184. } else {
  2185. pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId()));
  2186. }
  2187. //所有滞后
  2188. List<PmDemand> demandList = pmDemandMapper.countProjectExceedAll(pmDemandReqVo);
  2189. Date now = new Date();
  2190. //滞后时长包括:滞后1个月以内的采购任务、滞后1至3个月采购任务、滞后3至6个月采购任务、滞后6个月至1年采购任务、滞后1年以上采购任务
  2191. HashMap<String, Integer> map = new LinkedHashMap<>();
  2192. map.put("滞后1个月以内的采购任务", 0);
  2193. map.put("滞后1至3个月采购任务", 0);
  2194. map.put("滞后3至6个月采购任务", 0);
  2195. map.put("滞后6个月至1年采购任务", 0);
  2196. map.put("滞后1年以上采购任务", 0);
  2197. if (!ObjectUtils.isEmpty(demandList) && demandList.size() > 0) {
  2198. for (PmDemand demand : demandList) {
  2199. //滞后时间
  2200. Long exTime = 0L;
  2201. if (!ObjectUtils.isEmpty(demand.getRealPurchaseFinishTime()) && demand.getRealPurchaseFinishTime().getTime() - demand.getPlanPurchaseFinishTime().getTime() > 0) {
  2202. exTime = demand.getRealPurchaseFinishTime().getTime() - demand.getPlanPurchaseFinishTime().getTime();
  2203. } else {
  2204. exTime = now.getTime() - demand.getPlanPurchaseFinishTime().getTime();
  2205. }
  2206. if (exTime < Long.valueOf("2592000000")) {
  2207. map.put("滞后1个月以内的采购任务", map.get("滞后1个月以内的采购任务") + 1);
  2208. }
  2209. if (exTime >= Long.valueOf("2592000000") && exTime < Long.valueOf("7776000000")) {
  2210. map.put("滞后1至3个月采购任务", map.get("滞后1至3个月采购任务") + 1);
  2211. }
  2212. if (exTime >= Long.valueOf("7776000000") && exTime < Long.valueOf("15552000000")) {
  2213. map.put("滞后3至6个月采购任务", map.get("滞后3至6个月采购任务") + 1);
  2214. }
  2215. if (exTime >= Long.valueOf("15552000000") && exTime < Long.valueOf("31104000000")) {
  2216. map.put("滞后6个月至1年采购任务", map.get("滞后6个月至1年采购任务") + 1);
  2217. }
  2218. if (exTime > Long.valueOf("31104000000")) {
  2219. map.put("滞后1年以上采购任务", map.get("滞后1年以上采购任务") + 1);
  2220. }
  2221. }
  2222. }
  2223. return AjaxResult.success(map);
  2224. }
  2225. @Override
  2226. public AjaxResult countMajorProject(PmDemandReqVo pmDemandReqVo) {
  2227. //是-1就是查询自己及子孙级以下,否则只查询指定部门
  2228. if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) {
  2229. pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId()));
  2230. } else {
  2231. pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId()));
  2232. }
  2233. List<StatisticalChartsResVo> resVos = new ArrayList<>();
  2234. //本月度新提报重大规划采购任务数量
  2235. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.DEMAND_WAIT_COMMIT.getCode()));
  2236. StatisticalChartsResVo resVo = pmDemandMapper.majorProjectByStatusThisMonthSub(pmDemandReqVo);
  2237. resVo.setColumnName("本月度新提报");
  2238. resVo.setColumnNamePlus("重大规划采购任务数量");
  2239. resVos.add(resVo);
  2240. //本季度新提报重大规划采购任务数量
  2241. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.DEMAND_WAIT_COMMIT.getCode()));
  2242. StatisticalChartsResVo resVo2 = pmDemandMapper.majorProjectByStatusThisQuaSub(pmDemandReqVo);
  2243. resVo2.setColumnName("本季度新提报");
  2244. resVo2.setColumnNamePlus("重大规划采购任务数量");
  2245. resVos.add(resVo2);
  2246. //本年度新提报重大规划采购任务数量
  2247. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.DEMAND_WAIT_COMMIT.getCode()));
  2248. StatisticalChartsResVo resVo3 = pmDemandMapper.majorProjectByStatusThisYearSub(pmDemandReqVo);
  2249. resVo3.setColumnName("本年度新提报");
  2250. resVo3.setColumnNamePlus("重大规划采购任务数量");
  2251. resVos.add(resVo3);
  2252. //本月度完成重大规划采购任务数量
  2253. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.CONTRACT_WAIT_FILL.getCode()));
  2254. StatisticalChartsResVo resVo4 = pmDemandMapper.majorProjectByStatusThisMonthFi(pmDemandReqVo);
  2255. resVo4.setColumnName("本月度完成");
  2256. resVo4.setColumnNamePlus("重大规划采购任务数量");
  2257. resVos.add(resVo4);
  2258. //本季度完成重大规划采购任务数量
  2259. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.CONTRACT_WAIT_FILL.getCode()));
  2260. StatisticalChartsResVo resVo5 = pmDemandMapper.majorProjectByStatusThisQuaFi(pmDemandReqVo);
  2261. resVo5.setColumnName("本季度完成");
  2262. resVo5.setColumnNamePlus("重大规划采购任务数量");
  2263. resVos.add(resVo5);
  2264. //本年度完成重大规划采购任务数量
  2265. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.CONTRACT_WAIT_FILL.getCode()));
  2266. StatisticalChartsResVo resVo6 = pmDemandMapper.majorProjectByStatusThisYearFi(pmDemandReqVo);
  2267. resVo6.setColumnName("本年度完成");
  2268. resVo6.setColumnNamePlus("重大规划采购任务数量");
  2269. resVos.add(resVo6);
  2270. //上年度结转和本年度新提报重大规划采购任务累计项目数量
  2271. List<String> yearLastZ = new ArrayList<>();
  2272. yearLastZ.add(PmProjectStatus.DEMAND_WAIT_AUDIT.getCode());
  2273. yearLastZ.add(PmProjectStatus.DEMAND_AUDIT_RETURN.getCode());
  2274. yearLastZ.add(PmProjectStatus.TASK_WAIT_RELEASE.getCode());
  2275. yearLastZ.add(PmProjectStatus.PURCHASE_DEMAND_DOCKING.getCode());
  2276. yearLastZ.add(PmProjectStatus.EXPERT_FEEDBACK.getCode());
  2277. yearLastZ.add(PmProjectStatus.PROCUREMENT_DOCUMENTS_REVIEW.getCode());
  2278. yearLastZ.add(PmProjectStatus.PROCUREMENT_ANNOUNCEMENT.getCode());
  2279. yearLastZ.add(PmProjectStatus.PRE_BID_QUERY.getCode());
  2280. yearLastZ.add(PmProjectStatus.WAIT_OPEN_BID.getCode());
  2281. yearLastZ.add(PmProjectStatus.BID_RESULT_ANNOUNCEMENT.getCode());
  2282. yearLastZ.add(PmProjectStatus.WASTE_BID_HANDLE.getCode());
  2283. yearLastZ.add(PmProjectStatus.POST_BID_QUERY.getCode());
  2284. yearLastZ.add(PmProjectStatus.WASTE_BID_RETURN.getCode());
  2285. pmDemandReqVo.setProjectStatusList(yearLastZ);
  2286. StatisticalChartsResVo resVo7 = pmDemandMapper.majorProjectByStatusLastYear(pmDemandReqVo);
  2287. if (ObjectUtils.isEmpty(resVo7)) {
  2288. resVo7 = new StatisticalChartsResVo();
  2289. resVo7.setNum(0);
  2290. resVo7.setEvaluationTotal(BigDecimal.ZERO);
  2291. resVo7.setEvaluationContractTotal(BigDecimal.ZERO);
  2292. }
  2293. resVo7.setNum(resVo7.getNum() + resVo3.getNum());
  2294. resVo7.setEvaluationTotal(resVo7.getEvaluationTotal().add(resVo3.getEvaluationTotal()));
  2295. resVo7.setColumnName("上年度结转和本年度新提报");
  2296. resVo7.setColumnNamePlus("重大规划采购任务累计数量");
  2297. resVos.add(resVo7);
  2298. //今年以来累计完成数量
  2299. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.CONTRACT_WAIT_FILL.getCode()));
  2300. StatisticalChartsResVo resVo8 = pmDemandMapper.majorProjectByStatusToThisYear(pmDemandReqVo);
  2301. resVo8.setColumnName("今年以来累计");
  2302. resVo8.setColumnNamePlus("累计完成数量");
  2303. resVos.add(resVo8);
  2304. //正常推进周期内的重大规划采购任务数量
  2305. StatisticalChartsResVo resVo9 = pmDemandMapper.majorProjectByStatusWei(pmDemandReqVo);
  2306. resVo9.setColumnName("正常推进周期内");
  2307. resVo9.setColumnNamePlus("重大规划采购任务数量");
  2308. resVos.add(resVo9);
  2309. //执行滞后的重大规划采购任务数量
  2310. StatisticalChartsResVo resVo10 = pmDemandMapper.majorProjectByStatusChao(pmDemandReqVo);
  2311. resVo10.setColumnName("执行滞后");
  2312. resVo10.setColumnNamePlus("重大规划采购任务数量");
  2313. resVos.add(resVo10);
  2314. return AjaxResult.success(resVos);
  2315. }
  2316. @Override
  2317. public AjaxResult countMajorProjectCGB(PmDemandReqVo pmDemandReqVo) {
  2318. //是-1就是查询自己及子孙级以下,否则只查询指定部门
  2319. if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) {
  2320. pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId()));
  2321. } else {
  2322. pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId()));
  2323. }
  2324. List<StatisticalChartsResVo> resVos = new ArrayList<>();
  2325. //本月度新受领重大规划采购任务数量
  2326. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.TASK_WAIT_RELEASE.getCode()));
  2327. StatisticalChartsResVo resVo = pmDemandMapper.majorProjectByStatusThisMonthNew(pmDemandReqVo);
  2328. resVo.setColumnName("本月度新受领");
  2329. resVo.setColumnNamePlus("重大规划采购任务数量");
  2330. resVos.add(resVo);
  2331. //本季度新受领重大规划采购任务数量
  2332. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.TASK_WAIT_RELEASE.getCode()));
  2333. StatisticalChartsResVo resVo2 = pmDemandMapper.majorProjectByStatusThisQuaNew(pmDemandReqVo);
  2334. resVo2.setColumnName("本季度新受领");
  2335. resVo2.setColumnNamePlus("重大规划采购任务数量");
  2336. resVos.add(resVo2);
  2337. //本年度新受领重大规划采购任务数量
  2338. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.TASK_WAIT_RELEASE.getCode()));
  2339. StatisticalChartsResVo resVo3 = pmDemandMapper.majorProjectByStatusThisYearNew(pmDemandReqVo);
  2340. resVo3.setColumnName("本年度新受领");
  2341. resVo3.setColumnNamePlus("重大规划采购任务数量");
  2342. resVos.add(resVo3);
  2343. //上年度结转重大规划采购任务累计项目数量
  2344. List<String> yearLastZ = new ArrayList<>();
  2345. yearLastZ.add(PmProjectStatus.PURCHASE_DEMAND_DOCKING.getCode());
  2346. yearLastZ.add(PmProjectStatus.EXPERT_FEEDBACK.getCode());
  2347. yearLastZ.add(PmProjectStatus.PROCUREMENT_DOCUMENTS_REVIEW.getCode());
  2348. yearLastZ.add(PmProjectStatus.PROCUREMENT_ANNOUNCEMENT.getCode());
  2349. yearLastZ.add(PmProjectStatus.PRE_BID_QUERY.getCode());
  2350. yearLastZ.add(PmProjectStatus.WAIT_OPEN_BID.getCode());
  2351. yearLastZ.add(PmProjectStatus.BID_RESULT_ANNOUNCEMENT.getCode());
  2352. yearLastZ.add(PmProjectStatus.WASTE_BID_HANDLE.getCode());
  2353. yearLastZ.add(PmProjectStatus.POST_BID_QUERY.getCode());
  2354. yearLastZ.add(PmProjectStatus.WASTE_BID_RETURN.getCode());
  2355. pmDemandReqVo.setProjectStatusList(yearLastZ);
  2356. StatisticalChartsResVo resVo7 = pmDemandMapper.majorProjectByStatusLastYear(pmDemandReqVo);
  2357. if (ObjectUtils.isEmpty(resVo7)) {
  2358. resVo7 = new StatisticalChartsResVo();
  2359. resVo7.setNum(0);
  2360. resVo7.setEvaluationTotal(BigDecimal.ZERO);
  2361. resVo7.setEvaluationContractTotal(BigDecimal.ZERO);
  2362. }
  2363. resVo7.setColumnName("上年度结转和本年度新提报");
  2364. resVo7.setColumnNamePlus("累计项目数量");
  2365. //上年度结转和本月度新受领重大规划采购任务累计项目数量预算金额
  2366. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.DEMAND_WAIT_COMMIT.getCode()));
  2367. StatisticalChartsResVo resVo4 = pmDemandMapper.majorProjectByStatusThisMonthFiCGB(pmDemandReqVo);
  2368. if (ObjectUtils.isEmpty(resVo4)) {
  2369. resVo4 = new StatisticalChartsResVo();
  2370. resVo4.setNum(0);
  2371. resVo4.setEvaluationTotal(BigDecimal.ZERO);
  2372. resVo4.setEvaluationContractTotal(BigDecimal.ZERO);
  2373. }
  2374. resVo4.setNum(resVo4.getNum() + resVo7.getNum());
  2375. resVo4.setEvaluationTotal(resVo4.getEvaluationTotal().add(resVo7.getEvaluationTotal()));
  2376. resVo4.setColumnName("上年度结转和本月度新受领");
  2377. resVo4.setColumnNamePlus("累计项目数量");
  2378. resVos.add(resVo4);
  2379. //上年度结转和本季度新受领重大规划采购任务累计项目数量预算金额
  2380. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.DEMAND_WAIT_COMMIT.getCode()));
  2381. StatisticalChartsResVo resVo5 = pmDemandMapper.majorProjectByStatusThisQuaFiCGB(pmDemandReqVo);
  2382. if (ObjectUtils.isEmpty(resVo5)) {
  2383. resVo5 = new StatisticalChartsResVo();
  2384. resVo5.setNum(0);
  2385. resVo5.setEvaluationTotal(BigDecimal.ZERO);
  2386. resVo5.setEvaluationContractTotal(BigDecimal.ZERO);
  2387. }
  2388. resVo5.setNum(resVo5.getNum() + resVo7.getNum());
  2389. resVo5.setEvaluationTotal(resVo5.getEvaluationTotal().add(resVo7.getEvaluationTotal()));
  2390. resVo5.setColumnName("上年度结转和本季度新受领");
  2391. resVo5.setColumnNamePlus("累计项目数量");
  2392. resVos.add(resVo5);
  2393. //上年度结转和本年度新受领重大规划采购任务累计项目数量预算金额
  2394. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.DEMAND_WAIT_COMMIT.getCode()));
  2395. StatisticalChartsResVo resVo6 = pmDemandMapper.majorProjectByStatusThisYearFiCGB(pmDemandReqVo);
  2396. if (ObjectUtils.isEmpty(resVo6)) {
  2397. resVo6 = new StatisticalChartsResVo();
  2398. resVo6.setNum(0);
  2399. resVo6.setEvaluationTotal(BigDecimal.ZERO);
  2400. resVo6.setEvaluationContractTotal(BigDecimal.ZERO);
  2401. }
  2402. resVo6.setNum(resVo6.getNum() + resVo7.getNum());
  2403. resVo6.setEvaluationTotal(resVo6.getEvaluationTotal().add(resVo7.getEvaluationTotal()));
  2404. resVo6.setColumnName("上年度结转和本年度新受领");
  2405. resVo6.setColumnNamePlus("累计项目数量");
  2406. resVos.add(resVo6);
  2407. //本月度完成重大规划采购任务数量
  2408. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.CONTRACT_WAIT_FILL.getCode()));
  2409. StatisticalChartsResVo resVoA = pmDemandMapper.majorProjectByStatusThisMonthFi(pmDemandReqVo);
  2410. resVoA.setColumnName("本月度完成");
  2411. resVoA.setColumnNamePlus("重大规划采购任务数量");
  2412. resVos.add(resVoA);
  2413. //本季度完成重大规划采购任务数量
  2414. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.CONTRACT_WAIT_FILL.getCode()));
  2415. StatisticalChartsResVo resVoB = pmDemandMapper.majorProjectByStatusThisQuaFi(pmDemandReqVo);
  2416. resVoB.setColumnName("本季度完成");
  2417. resVoB.setColumnNamePlus("重大规划采购任务数量");
  2418. resVos.add(resVoB);
  2419. //本年度完成重大规划采购任务数量
  2420. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.CONTRACT_WAIT_FILL.getCode()));
  2421. StatisticalChartsResVo resVoC = pmDemandMapper.majorProjectByStatusThisYearFi(pmDemandReqVo);
  2422. resVoC.setColumnName("本年度完成");
  2423. resVoC.setColumnNamePlus("重大规划采购任务数量");
  2424. resVos.add(resVoC);
  2425. //今年以来累计完成数量
  2426. pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.CONTRACT_WAIT_FILL.getCode()));
  2427. StatisticalChartsResVo resVo8 = pmDemandMapper.majorProjectByStatusToThisYear(pmDemandReqVo);
  2428. resVo8.setColumnName("今年以来累计");
  2429. resVo8.setColumnNamePlus("累计完成数量");
  2430. resVos.add(resVo8);
  2431. //正常推进周期内的重大规划采购任务数量
  2432. StatisticalChartsResVo resVo9 = pmDemandMapper.majorProjectByStatusWei(pmDemandReqVo);
  2433. resVo9.setColumnName("正常推进周期内");
  2434. resVo9.setColumnNamePlus("重大规划采购任务数量");
  2435. resVos.add(resVo9);
  2436. //执行滞后的重大规划采购任务数量
  2437. StatisticalChartsResVo resVo10 = pmDemandMapper.majorProjectByStatusChao(pmDemandReqVo);
  2438. resVo10.setColumnName("执行滞后");
  2439. resVo10.setColumnNamePlus("重大规划采购任务数量");
  2440. resVos.add(resVo10);
  2441. return AjaxResult.success(resVos);
  2442. }
  2443. /**
  2444. * 通过计划ID查询项目数据
  2445. *
  2446. * @param planId
  2447. * @return
  2448. */
  2449. @Override
  2450. public PmDemand selectByPlanId(Long planId) {
  2451. return pmDemandMapper.selectByPlanId(planId);
  2452. }
  2453. /**
  2454. * 项目执行进度统计
  2455. * 1、正常推进项目数量:指未完成并且没有逾期的项目
  2456. * 预算金额:指未完成并且没有逾期的项目累加的预算金额
  2457. * 2、未完成采购任务:“合同待填制”状态之前的项目
  2458. * 预算金额:“合同待填制”状态之前的项目累加的预算金额
  2459. *
  2460. * @param pmDemandReqVo
  2461. * @return
  2462. */
  2463. @Override
  2464. public List<StatisticalChartsResVo> purchaseProjectExecute(PmDemandReqVo pmDemandReqVo) {
  2465. List<StatisticalChartsResVo> resVos = new ArrayList<>();
  2466. //是-1就是查询自己及子孙级以下,否则只查询指定部门
  2467. if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) {
  2468. pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId()));
  2469. } else {
  2470. pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId()));
  2471. }
  2472. //累计完成采购任务数量 预算金额(万元) 合同金额(万元)
  2473. StatisticalChartsResVo tThisYear = pmDemandMapper.selectFInishAll(pmDemandReqVo);
  2474. tThisYear.setColumnName("累计完成采购任务数量");
  2475. resVos.add(tThisYear);
  2476. // 正常推进项目数量、预算金额
  2477. StatisticalChartsResVo mapNormalPropulsion = pmDemandMapper.purchaseProjectExecuteNormalPropulsion(pmDemandReqVo);
  2478. mapNormalPropulsion.setColumnName("正常推进项目数量");
  2479. resVos.add(mapNormalPropulsion);
  2480. // 未完成采购任务,预算金额
  2481. StatisticalChartsResVo mapIncomplete = pmDemandMapper.purchaseProjectExecuteIncomplete(pmDemandReqVo);
  2482. mapIncomplete.setColumnName("未完成采购任务");
  2483. resVos.add(mapIncomplete);
  2484. return resVos;
  2485. }
  2486. /**
  2487. * 已完成项目数量统计
  2488. *
  2489. * @param pmDemandReqVo
  2490. * @return
  2491. */
  2492. @Override
  2493. public List<Map<String, Integer>> purchaseProjectCompleteNumber(PmDemandReqVo pmDemandReqVo) {
  2494. //是-1就是查询自己及子孙级以下,否则只查询指定部门
  2495. pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId()));
  2496. List<Map<String, Integer>> mapReturn = new ArrayList<>();
  2497. // 统计时间类型 1:年度,2:季度,3:月份
  2498. if ("1".equals(pmDemandReqVo.getTimeType())) {
  2499. // 查询数据库中最小的年份
  2500. int minYear = pmDemandMapper.selectMinYear();
  2501. // 获取当前年份
  2502. Calendar calendar = Calendar.getInstance();
  2503. int year = calendar.get(Calendar.YEAR);
  2504. // 获取统计数据
  2505. List<Map<String, Integer>> listMap = pmDemandMapper.selectpurchaseProjectCompleteNumberYear(pmDemandReqVo);
  2506. mapReturn.addAll(listMap);
  2507. for (int i = minYear; i <= year; i++) {
  2508. boolean isYear = false;
  2509. for (Map<String, Integer> map : listMap) {
  2510. if (i == Integer.parseInt(String.valueOf(map.get("yy")))) {
  2511. isYear = true;
  2512. }
  2513. }
  2514. if (!isYear) {
  2515. Map<String, Integer> map1 = new HashMap<>();
  2516. map1.put("yy", i);
  2517. map1.put("evaluation", 0);
  2518. map1.put("contractAmount", 0);
  2519. map1.put("countNum", 0);
  2520. mapReturn.add(map1);
  2521. }
  2522. }
  2523. } else if ("2".equals(pmDemandReqVo.getTimeType())) {
  2524. // 当前年份季度统计
  2525. // 获取统计数据
  2526. List<Map<String, Integer>> listMap = pmDemandMapper.selectpurchaseProjectCompleteNumberQuarter(pmDemandReqVo);
  2527. mapReturn.addAll(listMap);
  2528. for (int i = 1; i <= 4; i++) {
  2529. boolean isYear = false;
  2530. for (Map<String, Integer> map : listMap) {
  2531. if (i == Integer.parseInt(String.valueOf(map.get("yy")))) {
  2532. isYear = true;
  2533. }
  2534. }
  2535. if (!isYear) {
  2536. Map<String, Integer> map1 = new HashMap<>();
  2537. map1.put("yy", i);
  2538. map1.put("evaluation", 0);
  2539. map1.put("contractAmount", 0);
  2540. map1.put("countNum", 0);
  2541. mapReturn.add(map1);
  2542. }
  2543. }
  2544. } else if ("3".equals(pmDemandReqVo.getTimeType())) {
  2545. // 当前年份月份统计
  2546. // 获取统计数据
  2547. List<Map<String, Integer>> listMap = pmDemandMapper.selectpurchaseProjectCompleteNumberMonth(pmDemandReqVo);
  2548. mapReturn.addAll(listMap);
  2549. for (int i = 1; i <= 12; i++) {
  2550. boolean isYear = false;
  2551. for (Map<String, Integer> map : listMap) {
  2552. if (i == Integer.parseInt(String.valueOf(map.get("yy")))) {
  2553. isYear = true;
  2554. }
  2555. }
  2556. if (!isYear) {
  2557. Map<String, Integer> map1 = new HashMap<>();
  2558. map1.put("yy", i);
  2559. map1.put("evaluation", 0);
  2560. map1.put("contractAmount", 0);
  2561. map1.put("countNum", 0);
  2562. mapReturn.add(map1);
  2563. }
  2564. }
  2565. }
  2566. return mapReturn;
  2567. }
  2568. /**
  2569. * 已完成采购任务数量统计
  2570. *
  2571. * @param pmDemandReqVo
  2572. * @return
  2573. */
  2574. @Override
  2575. public List<Map<String, Integer>> purchaseTaskFinish(PmDemandReqVo pmDemandReqVo) {
  2576. //是-1就是查询自己及子孙级以下,否则只查询指定部门
  2577. if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) {
  2578. pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId()));
  2579. } else {
  2580. pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId()));
  2581. }
  2582. List<Map<String, Integer>> mapReturn = new ArrayList<>();
  2583. // 统计时间类型 1:年度,2:季度,3:月份
  2584. if ("1".equals(pmDemandReqVo.getTimeType())) {
  2585. // 查询数据库中最小的年份
  2586. int minYear = pmDemandMapper.selectMinYear();
  2587. // 获取当前年份
  2588. Calendar calendar = Calendar.getInstance();
  2589. int year = calendar.get(Calendar.YEAR);
  2590. // 获取统计数据
  2591. List<Map<String, Integer>> listMap = pmDemandMapper.selectPurchaseTaskFinishYear(pmDemandReqVo);
  2592. //mapReturn.addAll(listMap);
  2593. for (int i = minYear; i <= year; i++) {
  2594. boolean isYear = false;
  2595. for (Map<String, Integer> map : listMap) {
  2596. if (i == Integer.parseInt(String.valueOf(map.get("yy")))) {
  2597. isYear = true;
  2598. map.put("yy", i);
  2599. mapReturn.add(map);
  2600. }
  2601. }
  2602. if (!isYear) {
  2603. Map<String, Integer> map1 = new HashMap<>();
  2604. map1.put("yy", i);
  2605. map1.put("evaluation", 0);
  2606. map1.put("contractAmount", 0);
  2607. map1.put("countNum", 0);
  2608. mapReturn.add(map1);
  2609. }
  2610. }
  2611. } else if ("2".equals(pmDemandReqVo.getTimeType())) {
  2612. // 当前年份季度统计
  2613. // 获取统计数据
  2614. List<Map<String, Integer>> listMap = pmDemandMapper.selectPurchaseTaskFinishQuarter(pmDemandReqVo);
  2615. //mapReturn.addAll(listMap);
  2616. for (int i = 1; i <= 4; i++) {
  2617. boolean isYear = false;
  2618. for (Map<String, Integer> map : listMap) {
  2619. if (i == Integer.parseInt(String.valueOf(map.get("yy")))) {
  2620. isYear = true;
  2621. map.put("yy", i);
  2622. mapReturn.add(map);
  2623. }
  2624. }
  2625. if (!isYear) {
  2626. Map<String, Integer> map1 = new HashMap<>();
  2627. map1.put("yy", i);
  2628. map1.put("evaluation", 0);
  2629. map1.put("contractAmount", 0);
  2630. map1.put("countNum", 0);
  2631. mapReturn.add(map1);
  2632. }
  2633. }
  2634. } else if ("3".equals(pmDemandReqVo.getTimeType())) {
  2635. // 当前年份月份统计
  2636. // 获取统计数据
  2637. List<Map<String, Integer>> listMap = pmDemandMapper.selectPurchaseTaskFinishMonth(pmDemandReqVo);
  2638. //mapReturn.addAll(listMap);
  2639. for (int i = 1; i <= 12; i++) {
  2640. boolean isYear = false;
  2641. for (Map<String, Integer> map : listMap) {
  2642. if (i == Integer.parseInt(String.valueOf(map.get("yy")))) {
  2643. isYear = true;
  2644. map.put("yy", i);
  2645. map.put("countNum", 0);
  2646. mapReturn.add(map);
  2647. }
  2648. }
  2649. if (!isYear) {
  2650. Map<String, Integer> map1 = new HashMap<>();
  2651. map1.put("yy", i);
  2652. map1.put("evaluation", 0);
  2653. map1.put("contractAmount", 0);
  2654. map1.put("countNum", 0);
  2655. mapReturn.add(map1);
  2656. }
  2657. }
  2658. }
  2659. return mapReturn;
  2660. }
  2661. /**
  2662. * 项目数量分析---------年度的同比和环比不展示-----------
  2663. *
  2664. * @param pmDemandReqVo
  2665. * @return
  2666. */
  2667. @Override
  2668. public List<Map<String, String>> purchaseProjectNumberAnalysis(PmDemandReqVo pmDemandReqVo) {
  2669. //是-1就是查询自己及子孙级以下,否则只查询指定部门
  2670. if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) {
  2671. pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId()));
  2672. } else {
  2673. pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId()));
  2674. }
  2675. List<Map<String, String>> mapReturn = new ArrayList<>();
  2676. // 统计时间类型 1:年度,2:季度,3:月份
  2677. if ("1".equals(pmDemandReqVo.getTimeType())) {
  2678. // 查询数据库中最小的年份
  2679. int minYear = pmDemandMapper.selectMinYear();
  2680. // 获取当前年份
  2681. Calendar calendar = Calendar.getInstance();
  2682. int year = calendar.get(Calendar.YEAR);
  2683. // 获取统计数据
  2684. // 获取项目统计
  2685. List<Map<String, String>> listMap = pmDemandMapper.purchaseProjectNumberAnalysisYear(pmDemandReqVo);
  2686. mapReturn.addAll(listMap);
  2687. for (int i = minYear; i <= year; i++) {
  2688. boolean isYear = false;
  2689. for (Map<String, String> map : listMap) {
  2690. if (i == Integer.parseInt(String.valueOf(map.get("yy")))) {
  2691. isYear = true;
  2692. }
  2693. }
  2694. if (!isYear) {
  2695. Map<String, String> map1 = new HashMap<>();
  2696. map1.put("yy", i + "");
  2697. map1.put("countNum", 0 + "");
  2698. map1.put("evaluationSum", 0 + "");
  2699. mapReturn.add(map1);
  2700. }
  2701. }
  2702. } else if ("2".equals(pmDemandReqVo.getTimeType())) {
  2703. // 当前年份季度统计
  2704. // 获取统计数据
  2705. List<Map<String, String>> listMap = pmDemandMapper.purchaseProjectNumberAnalysisQuarter(pmDemandReqVo);
  2706. List<Map<String, String>> mapList = new ArrayList<>();
  2707. mapList.addAll(listMap);
  2708. for (int i = 1; i <= 4; i++) {
  2709. boolean isYear = false;
  2710. for (Map<String, String> map : listMap) {
  2711. if (i == Integer.parseInt(String.valueOf(map.get("yy")))) {
  2712. isYear = true;
  2713. }
  2714. }
  2715. if (!isYear) {
  2716. Map<String, String> map1 = new HashMap<>();
  2717. map1.put("yy", i + "");
  2718. map1.put("countNum", 0 + "");
  2719. map1.put("evaluationSum", 0 + "");
  2720. mapList.add(map1);
  2721. }
  2722. }
  2723. Map<String, String> map1 = new HashMap<>();
  2724. Map<String, String> map2 = new HashMap<>();
  2725. Map<String, String> map3 = new HashMap<>();
  2726. Map<String, String> map4 = new HashMap<>();
  2727. for (Map<String, String> map : mapList) {
  2728. String yy = String.valueOf(map.get("yy"));
  2729. if ("1".equals(yy)) {
  2730. map1.putAll(map);
  2731. } else if ("2".equals(yy)) {
  2732. map2.putAll(map);
  2733. } else if ("3".equals(yy)) {
  2734. map3.putAll(map);
  2735. } else if ("4".equals(yy)) {
  2736. map4.putAll(map);
  2737. }
  2738. }
  2739. String countNum1 = String.valueOf(map1.get("countNum"));
  2740. String countNum2 = String.valueOf(map2.get("countNum"));
  2741. String countNum3 = String.valueOf(map3.get("countNum"));
  2742. String countNum4 = String.valueOf(map4.get("countNum"));
  2743. String evaluationSum1 = String.valueOf(map1.get("evaluationSum"));
  2744. String evaluationSum2 = String.valueOf(map2.get("evaluationSum"));
  2745. String evaluationSum3 = String.valueOf(map3.get("evaluationSum"));
  2746. String evaluationSum4 = String.valueOf(map4.get("evaluationSum"));
  2747. // 查询上一年四季度数据
  2748. List<Map<String, String>> listMapOldYear = pmDemandMapper.purchaseProjectNumberAnalysisOldYearQuarter(pmDemandReqVo);
  2749. List<Map<String, String>> mapListOld = new ArrayList<>();
  2750. mapListOld.addAll(listMapOldYear);
  2751. for (int i = 1; i <= 4; i++) {
  2752. boolean isYear = false;
  2753. for (Map<String, String> map : listMapOldYear) {
  2754. if (i == Integer.parseInt(String.valueOf(map.get("yy")))) {
  2755. isYear = true;
  2756. }
  2757. }
  2758. if (!isYear) {
  2759. Map<String, String> map11 = new HashMap<>();
  2760. map11.put("yy", i + "");
  2761. map11.put("countNum", 0 + "");
  2762. map11.put("evaluationSum", 0 + "");
  2763. mapListOld.add(map11);
  2764. }
  2765. }
  2766. Map<String, String> mapOld1 = new HashMap<>();
  2767. Map<String, String> mapOld2 = new HashMap<>();
  2768. Map<String, String> mapOld3 = new HashMap<>();
  2769. Map<String, String> mapOld4 = new HashMap<>();
  2770. for (Map<String, String> mapOld : mapListOld) {
  2771. String yy = String.valueOf(mapOld.get("yy"));
  2772. if ("1".equals(yy)) {
  2773. mapOld1.putAll(mapOld);
  2774. } else if ("2".equals(yy)) {
  2775. mapOld2.putAll(mapOld);
  2776. } else if ("3".equals(yy)) {
  2777. mapOld3.putAll(mapOld);
  2778. } else if ("4".equals(yy)) {
  2779. mapOld4.putAll(mapOld);
  2780. }
  2781. }
  2782. String countNumOld1 = String.valueOf(mapOld1.get("countNum"));
  2783. String countNumOld2 = String.valueOf(mapOld2.get("countNum"));
  2784. String countNumOld3 = String.valueOf(mapOld3.get("countNum"));
  2785. String countNumOld4 = String.valueOf(mapOld4.get("countNum"));
  2786. String evaluationSumOld1 = String.valueOf(mapOld1.get("evaluationSum"));
  2787. String evaluationSumOld2 = String.valueOf(mapOld2.get("evaluationSum"));
  2788. String evaluationSumOld3 = String.valueOf(mapOld3.get("evaluationSum"));
  2789. String evaluationSumOld4 = String.valueOf(mapOld4.get("evaluationSum"));
  2790. BigDecimal countNum11 = new BigDecimal(countNum1);
  2791. BigDecimal countNum22 = new BigDecimal(countNum2);
  2792. BigDecimal countNum33 = new BigDecimal(countNum3);
  2793. BigDecimal countNum44 = new BigDecimal(countNum4);
  2794. BigDecimal countNumOld11 = new BigDecimal(countNumOld1);
  2795. BigDecimal countNumOld22 = new BigDecimal(countNumOld2);
  2796. BigDecimal countNumOld33 = new BigDecimal(countNumOld3);
  2797. BigDecimal countNumOld44 = new BigDecimal(countNumOld4);
  2798. BigDecimal evaluationSum11 = new BigDecimal(evaluationSum1);
  2799. BigDecimal evaluationSum22 = new BigDecimal(evaluationSum2);
  2800. BigDecimal evaluationSum33 = new BigDecimal(evaluationSum3);
  2801. BigDecimal evaluationSum44 = new BigDecimal(evaluationSum4);
  2802. BigDecimal evaluationSumOld11 = new BigDecimal(evaluationSumOld1);
  2803. BigDecimal evaluationSumOld22 = new BigDecimal(evaluationSumOld2);
  2804. BigDecimal evaluationSumOld33 = new BigDecimal(evaluationSumOld3);
  2805. BigDecimal evaluationSumOld44 = new BigDecimal(evaluationSumOld4);
  2806. // 项目数量环比 对比
  2807. BigDecimal monthonmonthNum1 = new BigDecimal(0.00);
  2808. BigDecimal monthonmonthNum2 = new BigDecimal(0.00);
  2809. BigDecimal monthonmonthNum3 = new BigDecimal(0.00);
  2810. BigDecimal monthonmonthNum4 = new BigDecimal(0.00);
  2811. if (!"0".equals(countNumOld4)) {
  2812. monthonmonthNum1 = (countNum11.subtract(countNumOld44)).divide(countNumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  2813. }
  2814. if (!"0".equals(countNum1)) {
  2815. monthonmonthNum2 = (countNum22.subtract(countNum11)).divide(countNum11, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  2816. }
  2817. if (!"0".equals(countNum2)) {
  2818. monthonmonthNum3 = (countNum33.subtract(countNum22)).divide(countNum22, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  2819. }
  2820. if (!"0".equals(countNum3)) {
  2821. monthonmonthNum4 = (countNum44.subtract(countNum33)).divide(countNum33, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  2822. }
  2823. map1.put("monthonmonthNum", monthonmonthNum1.toString());
  2824. map2.put("monthonmonthNum", monthonmonthNum2.toString());
  2825. map3.put("monthonmonthNum", monthonmonthNum3.toString());
  2826. map4.put("monthonmonthNum", monthonmonthNum4.toString());
  2827. // 项目数量同比 对比
  2828. BigDecimal yearonyearNum1 = new BigDecimal(0.00);
  2829. BigDecimal yearonyearNum2 = new BigDecimal(0.00);
  2830. BigDecimal yearonyearNum3 = new BigDecimal(0.00);
  2831. BigDecimal yearonyearNum4 = new BigDecimal(0.00);
  2832. if (!"0".equals(countNumOld1)) {
  2833. yearonyearNum1 = (countNum11.subtract(countNumOld11)).divide(countNumOld11, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  2834. }
  2835. if (!"0".equals(countNumOld2)) {
  2836. yearonyearNum2 = (countNum22.subtract(countNumOld22)).divide(countNumOld22, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  2837. }
  2838. if (!"0".equals(countNumOld3)) {
  2839. yearonyearNum3 = (countNum33.subtract(countNumOld33)).divide(countNumOld33, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  2840. }
  2841. if (!"0".equals(countNumOld4)) {
  2842. yearonyearNum4 = (countNum44.subtract(countNumOld44)).divide(countNumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  2843. }
  2844. map1.put("yearonyearNum", yearonyearNum1.toString());
  2845. map2.put("yearonyearNum", yearonyearNum2.toString());
  2846. map3.put("yearonyearNum", yearonyearNum3.toString());
  2847. map4.put("yearonyearNum", yearonyearNum4.toString());
  2848. // 预算金额环比 对比
  2849. BigDecimal monthonmonthAmount1 = new BigDecimal(0.00);
  2850. BigDecimal monthonmonthAmount2 = new BigDecimal(0.00);
  2851. BigDecimal monthonmonthAmount3 = new BigDecimal(0.00);
  2852. BigDecimal monthonmonthAmount4 = new BigDecimal(0.00);
  2853. if (!"0".equals(evaluationSumOld4)) {
  2854. monthonmonthAmount1 = (evaluationSum11.subtract(evaluationSumOld44)).divide(evaluationSumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  2855. }
  2856. if (!"0".equals(evaluationSum1)) {
  2857. monthonmonthAmount2 = (evaluationSum22.subtract(evaluationSum11)).divide(evaluationSum11, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  2858. }
  2859. if (!"0".equals(evaluationSum2)) {
  2860. monthonmonthAmount3 = (evaluationSum33.subtract(evaluationSum22)).divide(evaluationSum22, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  2861. }
  2862. if (!"0".equals(evaluationSum3)) {
  2863. monthonmonthAmount4 = (evaluationSum44.subtract(evaluationSum33)).divide(evaluationSum33, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  2864. }
  2865. map1.put("monthonmonthAmount", monthonmonthAmount1.toString());
  2866. map2.put("monthonmonthAmount", monthonmonthAmount2.toString());
  2867. map3.put("monthonmonthAmount", monthonmonthAmount3.toString());
  2868. map4.put("monthonmonthAmount", monthonmonthAmount4.toString());
  2869. // 预算金额同比比 对比
  2870. BigDecimal yearonyearAmount1 = new BigDecimal(0.00);
  2871. BigDecimal yearonyearAmount2 = new BigDecimal(0.00);
  2872. BigDecimal yearonyearAmount3 = new BigDecimal(0.00);
  2873. BigDecimal yearonyearAmount4 = new BigDecimal(0.00);
  2874. if (!"0".equals(evaluationSumOld1)) {
  2875. yearonyearAmount1 = (evaluationSum11.subtract(evaluationSumOld11)).divide(evaluationSumOld11, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  2876. }
  2877. if (!"0".equals(evaluationSumOld2)) {
  2878. yearonyearAmount2 = (evaluationSum22.subtract(evaluationSumOld22)).divide(evaluationSumOld22, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  2879. }
  2880. if (!"0".equals(evaluationSumOld3)) {
  2881. yearonyearAmount3 = (evaluationSum33.subtract(evaluationSumOld33)).divide(evaluationSumOld33, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  2882. }
  2883. if (!"0".equals(evaluationSumOld4)) {
  2884. yearonyearAmount4 = (evaluationSum44.subtract(evaluationSumOld44)).divide(evaluationSumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  2885. }
  2886. map1.put("yearonyearAmount", yearonyearAmount1.toString());
  2887. map2.put("yearonyearAmount", yearonyearAmount2.toString());
  2888. map3.put("yearonyearAmount", yearonyearAmount3.toString());
  2889. map4.put("yearonyearAmount", yearonyearAmount4.toString());
  2890. // 存入集合
  2891. mapReturn.add(map1);
  2892. mapReturn.add(map2);
  2893. mapReturn.add(map3);
  2894. mapReturn.add(map4);
  2895. } else if ("3".equals(pmDemandReqVo.getTimeType())) {
  2896. // 当前年份月份统计
  2897. // 获取统计数据
  2898. List<Map<String, String>> listMap = pmDemandMapper.purchaseProjectNumberAnalysisMonth(pmDemandReqVo);
  2899. List<Map<String, String>> mapList = new ArrayList<>();
  2900. mapList.addAll(listMap);
  2901. for (int i = 1; i <= 12; i++) {
  2902. boolean isYear = false;
  2903. for (Map<String, String> map : listMap) {
  2904. String yy = String.valueOf(map.get("yy"));
  2905. String yyNew = yy.replaceAll("^0*", "");
  2906. if (i == Integer.valueOf(yyNew)) {
  2907. isYear = true;
  2908. }
  2909. }
  2910. if (!isYear) {
  2911. Map<String, String> map1 = new HashMap<>();
  2912. String yy = String.format("%02d", i);
  2913. map1.put("yy", yy);
  2914. map1.put("countNum", 0 + "");
  2915. map1.put("evaluationSum", 0 + "");
  2916. mapList.add(map1);
  2917. }
  2918. }
  2919. Map<String, String> map1 = new HashMap<>();
  2920. Map<String, String> map2 = new HashMap<>();
  2921. Map<String, String> map3 = new HashMap<>();
  2922. Map<String, String> map4 = new HashMap<>();
  2923. Map<String, String> map5 = new HashMap<>();
  2924. Map<String, String> map6 = new HashMap<>();
  2925. Map<String, String> map7 = new HashMap<>();
  2926. Map<String, String> map8 = new HashMap<>();
  2927. Map<String, String> map9 = new HashMap<>();
  2928. Map<String, String> map10 = new HashMap<>();
  2929. Map<String, String> map11 = new HashMap<>();
  2930. Map<String, String> map12 = new HashMap<>();
  2931. for (Map<String, String> map : mapList) {
  2932. String yy = String.valueOf(map.get("yy"));
  2933. if ("01".equals(yy)) {
  2934. map1.putAll(map);
  2935. } else if ("02".equals(yy)) {
  2936. map2.putAll(map);
  2937. } else if ("03".equals(yy)) {
  2938. map3.putAll(map);
  2939. } else if ("04".equals(yy)) {
  2940. map4.putAll(map);
  2941. } else if ("05".equals(yy)) {
  2942. map5.putAll(map);
  2943. } else if ("06".equals(yy)) {
  2944. map6.putAll(map);
  2945. } else if ("07".equals(yy)) {
  2946. map7.putAll(map);
  2947. } else if ("08".equals(yy)) {
  2948. map8.putAll(map);
  2949. } else if ("09".equals(yy)) {
  2950. map9.putAll(map);
  2951. } else if ("10".equals(yy)) {
  2952. map10.putAll(map);
  2953. } else if ("11".equals(yy)) {
  2954. map11.putAll(map);
  2955. } else if ("12".equals(yy)) {
  2956. map12.putAll(map);
  2957. }
  2958. }
  2959. String countNum1 = String.valueOf(map1.get("countNum"));
  2960. String countNum2 = String.valueOf(map2.get("countNum"));
  2961. String countNum3 = String.valueOf(map3.get("countNum"));
  2962. String countNum4 = String.valueOf(map4.get("countNum"));
  2963. String countNum5 = String.valueOf(map5.get("countNum"));
  2964. String countNum6 = String.valueOf(map6.get("countNum"));
  2965. String countNum7 = String.valueOf(map7.get("countNum"));
  2966. String countNum8 = String.valueOf(map8.get("countNum"));
  2967. String countNum9 = String.valueOf(map9.get("countNum"));
  2968. String countNum10 = String.valueOf(map10.get("countNum"));
  2969. String countNum11 = String.valueOf(map11.get("countNum"));
  2970. String countNum12 = String.valueOf(map12.get("countNum"));
  2971. String evaluationSum1 = String.valueOf(map1.get("evaluationSum"));
  2972. String evaluationSum2 = String.valueOf(map2.get("evaluationSum"));
  2973. String evaluationSum3 = String.valueOf(map3.get("evaluationSum"));
  2974. String evaluationSum4 = String.valueOf(map4.get("evaluationSum"));
  2975. String evaluationSum5 = String.valueOf(map5.get("evaluationSum"));
  2976. String evaluationSum6 = String.valueOf(map6.get("evaluationSum"));
  2977. String evaluationSum7 = String.valueOf(map7.get("evaluationSum"));
  2978. String evaluationSum8 = String.valueOf(map8.get("evaluationSum"));
  2979. String evaluationSum9 = String.valueOf(map9.get("evaluationSum"));
  2980. String evaluationSum10 = String.valueOf(map10.get("evaluationSum"));
  2981. String evaluationSum11 = String.valueOf(map11.get("evaluationSum"));
  2982. String evaluationSum12 = String.valueOf(map12.get("evaluationSum"));
  2983. // 查询上一年月份数据
  2984. List<Map<String, String>> listMapOldMonth = pmDemandMapper.purchaseProjectNumberAnalysisOldYearMonth(pmDemandReqVo);
  2985. List<Map<String, String>> mapListOld = new ArrayList<>();
  2986. mapListOld.addAll(listMapOldMonth);
  2987. for (int i = 1; i <= 12; i++) {
  2988. boolean isYear = false;
  2989. for (Map<String, String> map : listMapOldMonth) {
  2990. String yy = String.valueOf(map.get("yy"));
  2991. String yyNew = yy.replaceAll("^0*", "");
  2992. if (i == Integer.valueOf(yyNew)) {
  2993. isYear = true;
  2994. }
  2995. }
  2996. if (!isYear) {
  2997. Map<String, String> map111 = new HashMap<>();
  2998. String yy = String.format("%02d", i);
  2999. map111.put("yy", yy);
  3000. map111.put("countNum", 0 + "");
  3001. map111.put("evaluationSum", 0 + "");
  3002. mapListOld.add(map111);
  3003. }
  3004. }
  3005. Map<String, String> mapOld1 = new HashMap<>();
  3006. Map<String, String> mapOld2 = new HashMap<>();
  3007. Map<String, String> mapOld3 = new HashMap<>();
  3008. Map<String, String> mapOld4 = new HashMap<>();
  3009. Map<String, String> mapOld5 = new HashMap<>();
  3010. Map<String, String> mapOld6 = new HashMap<>();
  3011. Map<String, String> mapOld7 = new HashMap<>();
  3012. Map<String, String> mapOld8 = new HashMap<>();
  3013. Map<String, String> mapOld9 = new HashMap<>();
  3014. Map<String, String> mapOld10 = new HashMap<>();
  3015. Map<String, String> mapOld11 = new HashMap<>();
  3016. Map<String, String> mapOld12 = new HashMap<>();
  3017. for (Map<String, String> mapOld : mapListOld) {
  3018. String yy = String.valueOf(mapOld.get("yy"));
  3019. if ("01".equals(yy)) {
  3020. mapOld1.putAll(mapOld);
  3021. } else if ("02".equals(yy)) {
  3022. mapOld2.putAll(mapOld);
  3023. } else if ("03".equals(yy)) {
  3024. mapOld3.putAll(mapOld);
  3025. } else if ("04".equals(yy)) {
  3026. mapOld4.putAll(mapOld);
  3027. } else if ("05".equals(yy)) {
  3028. mapOld5.putAll(mapOld);
  3029. } else if ("06".equals(yy)) {
  3030. mapOld6.putAll(mapOld);
  3031. } else if ("07".equals(yy)) {
  3032. mapOld7.putAll(mapOld);
  3033. } else if ("08".equals(yy)) {
  3034. mapOld8.putAll(mapOld);
  3035. } else if ("09".equals(yy)) {
  3036. mapOld9.putAll(mapOld);
  3037. } else if ("10".equals(yy)) {
  3038. mapOld10.putAll(mapOld);
  3039. } else if ("11".equals(yy)) {
  3040. mapOld11.putAll(mapOld);
  3041. } else if ("12".equals(yy)) {
  3042. mapOld12.putAll(mapOld);
  3043. }
  3044. }
  3045. String countNumOld1 = String.valueOf(mapOld1.get("countNum"));
  3046. String countNumOld2 = String.valueOf(mapOld2.get("countNum"));
  3047. String countNumOld3 = String.valueOf(mapOld3.get("countNum"));
  3048. String countNumOld4 = String.valueOf(mapOld4.get("countNum"));
  3049. String countNumOld5 = String.valueOf(mapOld5.get("countNum"));
  3050. String countNumOld6 = String.valueOf(mapOld6.get("countNum"));
  3051. String countNumOld7 = String.valueOf(mapOld7.get("countNum"));
  3052. String countNumOld8 = String.valueOf(mapOld8.get("countNum"));
  3053. String countNumOld9 = String.valueOf(mapOld9.get("countNum"));
  3054. String countNumOld10 = String.valueOf(mapOld10.get("countNum"));
  3055. String countNumOld11 = String.valueOf(mapOld11.get("countNum"));
  3056. String countNumOld12 = String.valueOf(mapOld12.get("countNum"));
  3057. String evaluationSumOld1 = String.valueOf(mapOld1.get("evaluationSum"));
  3058. String evaluationSumOld2 = String.valueOf(mapOld2.get("evaluationSum"));
  3059. String evaluationSumOld3 = String.valueOf(mapOld3.get("evaluationSum"));
  3060. String evaluationSumOld4 = String.valueOf(mapOld4.get("evaluationSum"));
  3061. String evaluationSumOld5 = String.valueOf(mapOld5.get("evaluationSum"));
  3062. String evaluationSumOld6 = String.valueOf(mapOld6.get("evaluationSum"));
  3063. String evaluationSumOld7 = String.valueOf(mapOld7.get("evaluationSum"));
  3064. String evaluationSumOld8 = String.valueOf(mapOld8.get("evaluationSum"));
  3065. String evaluationSumOld9 = String.valueOf(mapOld9.get("evaluationSum"));
  3066. String evaluationSumOld10 = String.valueOf(mapOld10.get("evaluationSum"));
  3067. String evaluationSumOld11 = String.valueOf(mapOld11.get("evaluationSum"));
  3068. String evaluationSumOld12 = String.valueOf(mapOld12.get("evaluationSum"));
  3069. BigDecimal countNum111 = new BigDecimal(countNum1);
  3070. BigDecimal countNum22 = new BigDecimal(countNum2);
  3071. BigDecimal countNum33 = new BigDecimal(countNum3);
  3072. BigDecimal countNum44 = new BigDecimal(countNum4);
  3073. BigDecimal countNum55 = new BigDecimal(countNum5);
  3074. BigDecimal countNum66 = new BigDecimal(countNum6);
  3075. BigDecimal countNum77 = new BigDecimal(countNum7);
  3076. BigDecimal countNum88 = new BigDecimal(countNum8);
  3077. BigDecimal countNum99 = new BigDecimal(countNum9);
  3078. BigDecimal countNum1010 = new BigDecimal(countNum10);
  3079. BigDecimal countNum1111 = new BigDecimal(countNum11);
  3080. BigDecimal countNum1212 = new BigDecimal(countNum12);
  3081. BigDecimal countNumOld111 = new BigDecimal(countNumOld1);
  3082. BigDecimal countNumOld22 = new BigDecimal(countNumOld2);
  3083. BigDecimal countNumOld33 = new BigDecimal(countNumOld3);
  3084. BigDecimal countNumOld44 = new BigDecimal(countNumOld4);
  3085. BigDecimal countNumOld55 = new BigDecimal(countNumOld5);
  3086. BigDecimal countNumOld66 = new BigDecimal(countNumOld6);
  3087. BigDecimal countNumOld77 = new BigDecimal(countNumOld7);
  3088. BigDecimal countNumOld88 = new BigDecimal(countNumOld8);
  3089. BigDecimal countNumOld99 = new BigDecimal(countNumOld9);
  3090. BigDecimal countNumOld1010 = new BigDecimal(countNumOld10);
  3091. BigDecimal countNumOld1111 = new BigDecimal(countNumOld11);
  3092. BigDecimal countNumOld1212 = new BigDecimal(countNumOld12);
  3093. BigDecimal evaluationSum111 = new BigDecimal(evaluationSum1);
  3094. BigDecimal evaluationSum22 = new BigDecimal(evaluationSum2);
  3095. BigDecimal evaluationSum33 = new BigDecimal(evaluationSum3);
  3096. BigDecimal evaluationSum44 = new BigDecimal(evaluationSum4);
  3097. BigDecimal evaluationSum55 = new BigDecimal(evaluationSum5);
  3098. BigDecimal evaluationSum66 = new BigDecimal(evaluationSum6);
  3099. BigDecimal evaluationSum77 = new BigDecimal(evaluationSum7);
  3100. BigDecimal evaluationSum88 = new BigDecimal(evaluationSum8);
  3101. BigDecimal evaluationSum99 = new BigDecimal(evaluationSum9);
  3102. BigDecimal evaluationSum1010 = new BigDecimal(evaluationSum10);
  3103. BigDecimal evaluationSum1111 = new BigDecimal(evaluationSum11);
  3104. BigDecimal evaluationSum1212 = new BigDecimal(evaluationSum12);
  3105. BigDecimal evaluationSumOld111 = new BigDecimal(evaluationSumOld1);
  3106. BigDecimal evaluationSumOld22 = new BigDecimal(evaluationSumOld2);
  3107. BigDecimal evaluationSumOld33 = new BigDecimal(evaluationSumOld3);
  3108. BigDecimal evaluationSumOld44 = new BigDecimal(evaluationSumOld4);
  3109. BigDecimal evaluationSumOld55 = new BigDecimal(evaluationSumOld5);
  3110. BigDecimal evaluationSumOld66 = new BigDecimal(evaluationSumOld6);
  3111. BigDecimal evaluationSumOld77 = new BigDecimal(evaluationSumOld7);
  3112. BigDecimal evaluationSumOld88 = new BigDecimal(evaluationSumOld8);
  3113. BigDecimal evaluationSumOld99 = new BigDecimal(evaluationSumOld9);
  3114. BigDecimal evaluationSumOld1010 = new BigDecimal(evaluationSumOld10);
  3115. BigDecimal evaluationSumOld1111 = new BigDecimal(evaluationSumOld11);
  3116. BigDecimal evaluationSumOld1212 = new BigDecimal(evaluationSumOld12);
  3117. // 项目数量环比 对比
  3118. BigDecimal monthonmonthNum1 = new BigDecimal(0.00);
  3119. BigDecimal monthonmonthNum2 = new BigDecimal(0.00);
  3120. BigDecimal monthonmonthNum3 = new BigDecimal(0.00);
  3121. BigDecimal monthonmonthNum4 = new BigDecimal(0.00);
  3122. BigDecimal monthonmonthNum5 = new BigDecimal(0.00);
  3123. BigDecimal monthonmonthNum6 = new BigDecimal(0.00);
  3124. BigDecimal monthonmonthNum7 = new BigDecimal(0.00);
  3125. BigDecimal monthonmonthNum8 = new BigDecimal(0.00);
  3126. BigDecimal monthonmonthNum9 = new BigDecimal(0.00);
  3127. BigDecimal monthonmonthNum10 = new BigDecimal(0.00);
  3128. BigDecimal monthonmonthNum11 = new BigDecimal(0.00);
  3129. BigDecimal monthonmonthNum12 = new BigDecimal(0.00);
  3130. if (!"0".equals(countNumOld12)) {
  3131. monthonmonthNum1 = (countNum111.subtract(countNumOld1212)).divide(countNumOld1212, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3132. }
  3133. if (!"0".equals(countNum1)) {
  3134. monthonmonthNum2 = (countNum22.subtract(countNum111)).divide(countNum111, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3135. }
  3136. if (!"0".equals(countNum2)) {
  3137. monthonmonthNum3 = (countNum33.subtract(countNum22)).divide(countNum22, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3138. }
  3139. if (!"0".equals(countNum3)) {
  3140. monthonmonthNum4 = (countNum44.subtract(countNum33)).divide(countNum33, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3141. }
  3142. if (!"0".equals(countNum4)) {
  3143. monthonmonthNum5 = (countNum55.subtract(countNum44)).divide(countNum44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3144. }
  3145. if (!"0".equals(countNum5)) {
  3146. monthonmonthNum6 = (countNum66.subtract(countNum55)).divide(countNum55, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3147. }
  3148. if (!"0".equals(countNum6)) {
  3149. monthonmonthNum7 = (countNum77.subtract(countNum66)).divide(countNum66, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3150. }
  3151. if (!"0".equals(countNum7)) {
  3152. monthonmonthNum8 = (countNum88.subtract(countNum77)).divide(countNum77, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3153. }
  3154. if (!"0".equals(countNum8)) {
  3155. monthonmonthNum9 = (countNum99.subtract(countNum88)).divide(countNum88, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3156. }
  3157. if (!"0".equals(countNum9)) {
  3158. monthonmonthNum10 = (countNum1010.subtract(countNum99)).divide(countNum99, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3159. }
  3160. if (!"0".equals(countNum10)) {
  3161. monthonmonthNum11 = (countNum1111.subtract(countNum1010)).divide(countNum1010, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3162. }
  3163. if (!"0".equals(countNum11)) {
  3164. monthonmonthNum12 = (countNum1212.subtract(countNum1111)).divide(countNum1111, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3165. }
  3166. map1.put("monthonmonthNum", monthonmonthNum1.toString());
  3167. map2.put("monthonmonthNum", monthonmonthNum2.toString());
  3168. map3.put("monthonmonthNum", monthonmonthNum3.toString());
  3169. map4.put("monthonmonthNum", monthonmonthNum4.toString());
  3170. map5.put("monthonmonthNum", monthonmonthNum5.toString());
  3171. map6.put("monthonmonthNum", monthonmonthNum6.toString());
  3172. map7.put("monthonmonthNum", monthonmonthNum7.toString());
  3173. map8.put("monthonmonthNum", monthonmonthNum8.toString());
  3174. map9.put("monthonmonthNum", monthonmonthNum9.toString());
  3175. map10.put("monthonmonthNum", monthonmonthNum10.toString());
  3176. map11.put("monthonmonthNum", monthonmonthNum11.toString());
  3177. map12.put("monthonmonthNum", monthonmonthNum12.toString());
  3178. // 项目数量同比 对比
  3179. BigDecimal yearonyearNum1 = new BigDecimal(0.00);
  3180. BigDecimal yearonyearNum2 = new BigDecimal(0.00);
  3181. BigDecimal yearonyearNum3 = new BigDecimal(0.00);
  3182. BigDecimal yearonyearNum4 = new BigDecimal(0.00);
  3183. BigDecimal yearonyearNum5 = new BigDecimal(0.00);
  3184. BigDecimal yearonyearNum6 = new BigDecimal(0.00);
  3185. BigDecimal yearonyearNum7 = new BigDecimal(0.00);
  3186. BigDecimal yearonyearNum8 = new BigDecimal(0.00);
  3187. BigDecimal yearonyearNum9 = new BigDecimal(0.00);
  3188. BigDecimal yearonyearNum10 = new BigDecimal(0.00);
  3189. BigDecimal yearonyearNum11 = new BigDecimal(0.00);
  3190. BigDecimal yearonyearNum12 = new BigDecimal(0.00);
  3191. if (!"0".equals(countNumOld1)) {
  3192. yearonyearNum1 = (countNum111.subtract(countNumOld111)).divide(countNumOld111, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3193. }
  3194. if (!"0".equals(countNumOld2)) {
  3195. yearonyearNum2 = (countNum22.subtract(countNumOld22)).divide(countNumOld22, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3196. }
  3197. if (!"0".equals(countNumOld3)) {
  3198. yearonyearNum3 = (countNum33.subtract(countNumOld33)).divide(countNumOld33, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3199. }
  3200. if (!"0".equals(countNumOld4)) {
  3201. yearonyearNum4 = (countNum44.subtract(countNumOld44)).divide(countNumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3202. }
  3203. if (!"0".equals(countNumOld5)) {
  3204. yearonyearNum5 = (countNum55.subtract(countNumOld55)).divide(countNumOld55, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3205. }
  3206. if (!"0".equals(countNumOld6)) {
  3207. yearonyearNum6 = (countNum66.subtract(countNumOld66)).divide(countNumOld66, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3208. }
  3209. if (!"0".equals(countNumOld7)) {
  3210. yearonyearNum7 = (countNum77.subtract(countNumOld77)).divide(countNumOld77, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3211. }
  3212. if (!"0".equals(countNumOld8)) {
  3213. yearonyearNum8 = (countNum88.subtract(countNumOld88)).divide(countNumOld88, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3214. }
  3215. if (!"0".equals(countNumOld9)) {
  3216. yearonyearNum9 = (countNum99.subtract(countNumOld99)).divide(countNumOld99, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3217. }
  3218. if (!"0".equals(countNumOld10)) {
  3219. yearonyearNum10 = (countNum1010.subtract(countNumOld1010)).divide(countNumOld1010, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3220. }
  3221. if (!"0".equals(countNumOld11)) {
  3222. yearonyearNum11 = (countNum1111.subtract(countNumOld1111)).divide(countNumOld1111, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3223. }
  3224. if (!"0".equals(countNumOld12)) {
  3225. yearonyearNum12 = (countNum1212.subtract(countNumOld1212)).divide(countNumOld1212, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3226. }
  3227. map1.put("yearonyearNum", yearonyearNum1.toString());
  3228. map2.put("yearonyearNum", yearonyearNum2.toString());
  3229. map3.put("yearonyearNum", yearonyearNum3.toString());
  3230. map4.put("yearonyearNum", yearonyearNum4.toString());
  3231. map5.put("yearonyearNum", yearonyearNum5.toString());
  3232. map6.put("yearonyearNum", yearonyearNum6.toString());
  3233. map7.put("yearonyearNum", yearonyearNum7.toString());
  3234. map8.put("yearonyearNum", yearonyearNum8.toString());
  3235. map9.put("yearonyearNum", yearonyearNum9.toString());
  3236. map10.put("yearonyearNum", yearonyearNum10.toString());
  3237. map11.put("yearonyearNum", yearonyearNum11.toString());
  3238. map12.put("yearonyearNum", yearonyearNum12.toString());
  3239. // 预算金额环比 对比
  3240. BigDecimal monthonmonthAmount1 = new BigDecimal(0.00);
  3241. BigDecimal monthonmonthAmount2 = new BigDecimal(0.00);
  3242. BigDecimal monthonmonthAmount3 = new BigDecimal(0.00);
  3243. BigDecimal monthonmonthAmount4 = new BigDecimal(0.00);
  3244. BigDecimal monthonmonthAmount5 = new BigDecimal(0.00);
  3245. BigDecimal monthonmonthAmount6 = new BigDecimal(0.00);
  3246. BigDecimal monthonmonthAmount7 = new BigDecimal(0.00);
  3247. BigDecimal monthonmonthAmount8 = new BigDecimal(0.00);
  3248. BigDecimal monthonmonthAmount9 = new BigDecimal(0.00);
  3249. BigDecimal monthonmonthAmount10 = new BigDecimal(0.00);
  3250. BigDecimal monthonmonthAmount11 = new BigDecimal(0.00);
  3251. BigDecimal monthonmonthAmount12 = new BigDecimal(0.00);
  3252. if (!"0".equals(evaluationSumOld12)) {
  3253. monthonmonthAmount1 = (evaluationSum111.subtract(evaluationSumOld1212)).divide(evaluationSumOld1212, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3254. }
  3255. if (!"0".equals(evaluationSum1)) {
  3256. monthonmonthAmount2 = (evaluationSum22.subtract(evaluationSum111)).divide(evaluationSum111, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3257. }
  3258. if (!"0".equals(evaluationSum2)) {
  3259. monthonmonthAmount3 = (evaluationSum33.subtract(evaluationSum22)).divide(evaluationSum22, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3260. }
  3261. if (!"0".equals(evaluationSum3)) {
  3262. monthonmonthAmount4 = (evaluationSum44.subtract(evaluationSum33)).divide(evaluationSum33, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3263. }
  3264. if (!"0".equals(evaluationSum4)) {
  3265. monthonmonthAmount5 = (evaluationSum55.subtract(evaluationSum44)).divide(evaluationSum44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3266. }
  3267. if (!"0".equals(evaluationSum5)) {
  3268. monthonmonthAmount6 = (evaluationSum66.subtract(evaluationSum55)).divide(evaluationSum55, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3269. }
  3270. if (!"0".equals(evaluationSum6)) {
  3271. monthonmonthAmount7 = (evaluationSum77.subtract(evaluationSum66)).divide(evaluationSum66, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3272. }
  3273. if (!"0".equals(evaluationSum7)) {
  3274. monthonmonthAmount8 = (evaluationSum88.subtract(evaluationSum77)).divide(evaluationSum77, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3275. }
  3276. if (!"0".equals(evaluationSum8)) {
  3277. monthonmonthAmount9 = (evaluationSum99.subtract(evaluationSum88)).divide(evaluationSum88, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3278. }
  3279. if (!"0".equals(evaluationSum9)) {
  3280. monthonmonthAmount10 = (evaluationSum1010.subtract(evaluationSum99)).divide(evaluationSum99, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3281. }
  3282. if (!"0".equals(evaluationSum10)) {
  3283. monthonmonthAmount11 = (evaluationSum1111.subtract(evaluationSum1010)).divide(evaluationSum1010, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3284. }
  3285. if (!"0".equals(evaluationSum11)) {
  3286. monthonmonthAmount12 = (evaluationSum1212.subtract(evaluationSum1111)).divide(evaluationSum1111, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3287. }
  3288. map1.put("monthonmonthAmount", monthonmonthAmount1.toString());
  3289. map2.put("monthonmonthAmount", monthonmonthAmount2.toString());
  3290. map3.put("monthonmonthAmount", monthonmonthAmount3.toString());
  3291. map4.put("monthonmonthAmount", monthonmonthAmount4.toString());
  3292. map5.put("monthonmonthAmount", monthonmonthAmount5.toString());
  3293. map6.put("monthonmonthAmount", monthonmonthAmount6.toString());
  3294. map7.put("monthonmonthAmount", monthonmonthAmount7.toString());
  3295. map8.put("monthonmonthAmount", monthonmonthAmount8.toString());
  3296. map9.put("monthonmonthAmount", monthonmonthAmount9.toString());
  3297. map10.put("monthonmonthAmount", monthonmonthAmount10.toString());
  3298. map11.put("monthonmonthAmount", monthonmonthAmount11.toString());
  3299. map12.put("monthonmonthAmount", monthonmonthAmount12.toString());
  3300. // 预算金额同比比 对比
  3301. BigDecimal yearonyearAmount1 = new BigDecimal(0.00);
  3302. BigDecimal yearonyearAmount2 = new BigDecimal(0.00);
  3303. BigDecimal yearonyearAmount3 = new BigDecimal(0.00);
  3304. BigDecimal yearonyearAmount4 = new BigDecimal(0.00);
  3305. BigDecimal yearonyearAmount5 = new BigDecimal(0.00);
  3306. BigDecimal yearonyearAmount6 = new BigDecimal(0.00);
  3307. BigDecimal yearonyearAmount7 = new BigDecimal(0.00);
  3308. BigDecimal yearonyearAmount8 = new BigDecimal(0.00);
  3309. BigDecimal yearonyearAmount9 = new BigDecimal(0.00);
  3310. BigDecimal yearonyearAmount10 = new BigDecimal(0.00);
  3311. BigDecimal yearonyearAmount11 = new BigDecimal(0.00);
  3312. BigDecimal yearonyearAmount12 = new BigDecimal(0.00);
  3313. if (!"0".equals(evaluationSumOld1)) {
  3314. yearonyearAmount1 = (evaluationSum111.subtract(evaluationSumOld111)).divide(evaluationSumOld1111, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3315. }
  3316. if (!"0".equals(evaluationSumOld2)) {
  3317. yearonyearAmount2 = (evaluationSum22.subtract(evaluationSumOld22)).divide(evaluationSumOld22, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3318. }
  3319. if (!"0".equals(evaluationSumOld3)) {
  3320. yearonyearAmount3 = (evaluationSum33.subtract(evaluationSumOld33)).divide(evaluationSumOld33, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3321. }
  3322. if (!"0".equals(evaluationSumOld4)) {
  3323. yearonyearAmount4 = (evaluationSum44.subtract(evaluationSumOld44)).divide(evaluationSumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3324. }
  3325. if (!"0".equals(evaluationSumOld5)) {
  3326. yearonyearAmount5 = (evaluationSum55.subtract(evaluationSumOld55)).divide(evaluationSumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3327. }
  3328. if (!"0".equals(evaluationSumOld6)) {
  3329. yearonyearAmount6 = (evaluationSum66.subtract(evaluationSumOld66)).divide(evaluationSumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3330. }
  3331. if (!"0".equals(evaluationSumOld7)) {
  3332. yearonyearAmount7 = (evaluationSum77.subtract(evaluationSumOld77)).divide(evaluationSumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3333. }
  3334. if (!"0".equals(evaluationSumOld8)) {
  3335. yearonyearAmount8 = (evaluationSum88.subtract(evaluationSumOld88)).divide(evaluationSumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3336. }
  3337. if (!"0".equals(evaluationSumOld9)) {
  3338. yearonyearAmount9 = (evaluationSum99.subtract(evaluationSumOld99)).divide(evaluationSumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3339. }
  3340. if (!"0".equals(evaluationSumOld10)) {
  3341. yearonyearAmount10 = (evaluationSum1010.subtract(evaluationSumOld1010)).divide(evaluationSumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3342. }
  3343. if (!"0".equals(evaluationSumOld11)) {
  3344. yearonyearAmount11 = (evaluationSum1111.subtract(evaluationSumOld1111)).divide(evaluationSumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3345. }
  3346. if (!"0".equals(evaluationSumOld12)) {
  3347. yearonyearAmount12 = (evaluationSum1212.subtract(evaluationSumOld1212)).divide(evaluationSumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
  3348. }
  3349. map1.put("yearonyearAmount", yearonyearAmount1.toString());
  3350. map2.put("yearonyearAmount", yearonyearAmount2.toString());
  3351. map3.put("yearonyearAmount", yearonyearAmount3.toString());
  3352. map4.put("yearonyearAmount", yearonyearAmount4.toString());
  3353. map5.put("yearonyearAmount", yearonyearAmount5.toString());
  3354. map6.put("yearonyearAmount", yearonyearAmount6.toString());
  3355. map7.put("yearonyearAmount", yearonyearAmount7.toString());
  3356. map8.put("yearonyearAmount", yearonyearAmount8.toString());
  3357. map9.put("yearonyearAmount", yearonyearAmount9.toString());
  3358. map10.put("yearonyearAmount", yearonyearAmount10.toString());
  3359. map11.put("yearonyearAmount", yearonyearAmount11.toString());
  3360. map12.put("yearonyearAmount", yearonyearAmount12.toString());
  3361. // 存入集合
  3362. mapReturn.add(map1);
  3363. mapReturn.add(map2);
  3364. mapReturn.add(map3);
  3365. mapReturn.add(map4);
  3366. mapReturn.add(map5);
  3367. mapReturn.add(map6);
  3368. mapReturn.add(map7);
  3369. mapReturn.add(map8);
  3370. mapReturn.add(map9);
  3371. mapReturn.add(map10);
  3372. mapReturn.add(map11);
  3373. mapReturn.add(map12);
  3374. }
  3375. return mapReturn;
  3376. }
  3377. @Override
  3378. public List<StatisticalChartsResVo> demandSubCount(PmDemandReqVo pmDemandReqVo) {
  3379. //是-1就是查询自己及子孙级以下,否则只查询指定部门
  3380. if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) {
  3381. pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId()));
  3382. } else {
  3383. pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId()));
  3384. }
  3385. List<StatisticalChartsResVo> resVos = new ArrayList<>();
  3386. //本级和所属采购单位新提报采购需求数量--本年度中本级及下级审核的“需求待提交”之后状态的数据
  3387. StatisticalChartsResVo selectSTS = pmDemandMapper.selectSTS(pmDemandReqVo);
  3388. selectSTS.setColumnName("本级和所属采购单位新提报");
  3389. selectSTS.setColumnNamePlus("采购需求数量");
  3390. resVos.add(selectSTS);
  3391. //上年度结转和本年度提报的采购需求累计数量
  3392. //1.上年度结转:上年度“需求待提交”之后,“合同待填制”之前状态的数据
  3393. //2.本年度提报:指本年度“需求待提交”之后状态的数据
  3394. StatisticalChartsResVo lastYear = pmDemandMapper.selectSTSLastYear(pmDemandReqVo);
  3395. StatisticalChartsResVo thisYear = pmDemandMapper.selectSTSThisYear(pmDemandReqVo);
  3396. if (ObjectUtils.isEmpty(lastYear.getNum())) {
  3397. lastYear = new StatisticalChartsResVo();
  3398. lastYear.setNum(0);
  3399. lastYear.setEvaluationTotal(BigDecimal.ZERO);
  3400. lastYear.setEvaluationContractTotal(BigDecimal.ZERO);
  3401. }
  3402. if (ObjectUtils.isEmpty(thisYear.getNum())) {
  3403. thisYear = new StatisticalChartsResVo();
  3404. thisYear.setNum(0);
  3405. thisYear.setEvaluationTotal(BigDecimal.ZERO);
  3406. thisYear.setEvaluationContractTotal(BigDecimal.ZERO);
  3407. }
  3408. lastYear.setNum(lastYear.getNum() + thisYear.getNum());
  3409. lastYear.setEvaluationTotal(lastYear.getEvaluationTotal().add(thisYear.getEvaluationTotal()));
  3410. lastYear.setColumnName("上年度结转和本年度提报");
  3411. lastYear.setColumnNamePlus("采购需求累计数量");
  3412. resVos.add(lastYear);
  3413. //未按季度采购明细计划提报或调整延迟的数量--超过计划需求提报时间的项目
  3414. StatisticalChartsResVo meiJiDu = pmDemandMapper.selectmeiJiDu(pmDemandReqVo);
  3415. meiJiDu.setColumnName("未按季度采购明细计划提报或调整延迟");
  3416. meiJiDu.setColumnNamePlus("采购需求数量");
  3417. resVos.add(meiJiDu);
  3418. return resVos;
  3419. }
  3420. @Override
  3421. public List<StatisticalChartsResVo> countByProjectType(PmDemandReqVo pmDemandReqVo) {
  3422. //是-1就是查询自己及子孙级以下,否则只查询指定部门
  3423. if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) {
  3424. pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId()));
  3425. } else {
  3426. pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId()));
  3427. }
  3428. List<StatisticalChartsResVo> resultList = new ArrayList<>();
  3429. //项目类型情况统计--根据项目类型:物资类、服务类、工程类、装备类统计项目数量及预算金额
  3430. pmDemandReqVo.setProjectType(ProjectTypes.EQUIPMENTTYPE.getCode());
  3431. StatisticalChartsResVo res1 = pmDemandMapper.selectByProjectType(pmDemandReqVo);
  3432. res1.setColumnName(ProjectTypes.EQUIPMENTTYPE.getInfo());
  3433. resultList.add(res1);
  3434. pmDemandReqVo.setProjectType(ProjectTypes.MATERIALTYPE.getCode());
  3435. StatisticalChartsResVo res2 = pmDemandMapper.selectByProjectType(pmDemandReqVo);
  3436. res2.setColumnName(ProjectTypes.MATERIALTYPE.getInfo());
  3437. resultList.add(res2);
  3438. pmDemandReqVo.setProjectType(ProjectTypes.SERVICESTYPE.getCode());
  3439. StatisticalChartsResVo res3 = pmDemandMapper.selectByProjectType(pmDemandReqVo);
  3440. res3.setColumnName(ProjectTypes.SERVICESTYPE.getInfo());
  3441. resultList.add(res3);
  3442. pmDemandReqVo.setProjectType(ProjectTypes.PLANTOEXAMINETYPE.getCode());
  3443. StatisticalChartsResVo res4 = pmDemandMapper.selectByProjectType(pmDemandReqVo);
  3444. res4.setColumnName(ProjectTypes.PLANTOEXAMINETYPE.getInfo());
  3445. resultList.add(res4);
  3446. return resultList;
  3447. }
  3448. @Override
  3449. public List<StatisticalChartsResVo> countByPurchaseChange(PmDemandReqVo pmDemandReqVo) {
  3450. //是-1就是查询自己及子孙级以下,否则只查询指定部门
  3451. if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) {
  3452. pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId()));
  3453. } else {
  3454. pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId()));
  3455. }
  3456. List<StatisticalChartsResVo> byChange = new ArrayList<>();
  3457. //本月相关采购机构完成采购任务--状态为“标后质疑”后的数据
  3458. StatisticalChartsResVo thisMonth = pmDemandMapper.selectCGThisMonth(pmDemandReqVo);
  3459. thisMonth.setColumnName("本月相关采购机构");
  3460. thisMonth.setColumnNamePlus("完成采购任务数量");
  3461. byChange.add(thisMonth);
  3462. //本季度相关采购机构完成采购任务--状态为“标后质疑”后的数据
  3463. StatisticalChartsResVo thisQua = pmDemandMapper.selectCGThisQua(pmDemandReqVo);
  3464. thisQua.setColumnName("本季度相关采购机构");
  3465. thisQua.setColumnNamePlus("完成采购任务数量");
  3466. byChange.add(thisQua);
  3467. //上年度结转和本年度提报的采购需求中累计已完成的采购任务
  3468. //上年度结转:上年度“标后质疑”之后,“合同待填制”之前状态的数据
  3469. //本年度提报:状态为“标后质疑”后的数据
  3470. StatisticalChartsResVo zLastYear = pmDemandMapper.selectZJLastYear(pmDemandReqVo);
  3471. StatisticalChartsResVo tThisYear = pmDemandMapper.selectTBThisYear(pmDemandReqVo);
  3472. if (ObjectUtils.isEmpty(zLastYear.getNum())) {
  3473. zLastYear = new StatisticalChartsResVo();
  3474. zLastYear.setNum(0);
  3475. zLastYear.setEvaluationTotal(BigDecimal.ZERO);
  3476. zLastYear.setEvaluationContractTotal(BigDecimal.ZERO);
  3477. }
  3478. if (ObjectUtils.isEmpty(tThisYear.getNum())) {
  3479. tThisYear = new StatisticalChartsResVo();
  3480. tThisYear.setNum(0);
  3481. tThisYear.setEvaluationTotal(BigDecimal.ZERO);
  3482. tThisYear.setEvaluationContractTotal(BigDecimal.ZERO);
  3483. }
  3484. //tThisYear.setNum(ObjectUtils.isEmpty(tThisYear.getNum()) ? 0 : tThisYear.getNum() + (ObjectUtils.isEmpty(zLastYear.getNum()) ? 0 : zLastYear.getNum()));
  3485. //tThisYear.setEvaluationTotal((ObjectUtils.isEmpty(tThisYear.getEvaluationTotal()) ? BigDecimal.ZERO : tThisYear.getEvaluationTotal()).add((ObjectUtils.isEmpty(zLastYear.getEvaluationTotal()) ? BigDecimal.ZERO : zLastYear.getEvaluationTotal())));
  3486. //tThisYear.setEvaluationContractTotal((ObjectUtils.isEmpty(tThisYear.getEvaluationContractTotal()) ? BigDecimal.ZERO : tThisYear.getEvaluationContractTotal()).add(ObjectUtils.isEmpty(zLastYear.getEvaluationContractTotal()) ? BigDecimal.ZERO : zLastYear.getEvaluationContractTotal()));
  3487. tThisYear.setColumnName("上年度结转和本年度提报的采购需求");
  3488. tThisYear.setColumnNamePlus("累计完成采购任务数量");
  3489. byChange.add(tThisYear);
  3490. //正常推进周期内的采购任务--本年度项目未超过计划完成采购时间的数据
  3491. StatisticalChartsResVo cThisYear = pmDemandMapper.selectCCThisYear(pmDemandReqVo);
  3492. cThisYear.setColumnName("正常推进周期内");
  3493. cThisYear.setColumnNamePlus("采购任务数量");
  3494. byChange.add(cThisYear);
  3495. return byChange;
  3496. }
  3497. @Override
  3498. public AjaxResult exceedReason(PmDemandReqVo pmDemandReqVo) {
  3499. List<StatisticalChartsResVo> resVos = new ArrayList<>();
  3500. //是-1就是查询自己及子孙级以下,否则只查询指定部门
  3501. if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) {
  3502. pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId()));
  3503. } else {
  3504. pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId()));
  3505. }
  3506. //统计超过计划完成采购时间的项目中,处在各阶段的数据包括以下内容:
  3507. //1、需求编制对接数量/涉及金额:状态为“采购需求对接”的数量及预算金额
  3508. List<String> xqdj = new ArrayList<>();
  3509. xqdj.add(PmProjectStatus.PURCHASE_DEMAND_DOCKING.getCode());
  3510. pmDemandReqVo.setProjectStatusList(xqdj);
  3511. StatisticalChartsResVo resVo = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo);
  3512. resVo.setColumnName("需求编制对接数量");
  3513. resVos.add(resVo);
  3514. //2、采购文件编制审核数量/涉及金额:状态为“采购文件编制审核“的数量及预算金额
  3515. List<String> wjsh = new ArrayList<>();
  3516. wjsh.add(PmProjectStatus.PROCUREMENT_DOCUMENTS_REVIEW.getCode());
  3517. pmDemandReqVo.setProjectStatusList(wjsh);
  3518. StatisticalChartsResVo resVo2 = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo);
  3519. resVo2.setColumnName("采购文件编制审核数量");
  3520. resVos.add(resVo2);
  3521. //3、质疑、投诉、复议、信访举报数量/涉及金额:按钮”质疑投诉”进行质疑过的项目及预算金额
  3522. List<Long> demandIdAll = questionHisService.selectDemandIdAll();
  3523. pmDemandReqVo.setDemandIdAll(demandIdAll);
  3524. StatisticalChartsResVo resVo3 = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo);
  3525. resVo3.setColumnName("质疑、投诉、复议、信访举报数量");
  3526. resVos.add(resVo3);
  3527. //4、流标废标数量/涉及金额:状态为“流废标处置”的项目及预算金额
  3528. List<String> fblb = new ArrayList<>();
  3529. fblb.add(PmProjectStatus.WASTE_BID_HANDLE.getCode());
  3530. pmDemandReqVo.setProjectStatusList(fblb);
  3531. StatisticalChartsResVo resVo4 = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo);
  3532. resVo4.setColumnName("流标废标数量");
  3533. resVos.add(resVo4);
  3534. //5、其他原因项目数量/涉及金额:统计“专家意见反馈”、“采购公告发布”、”待开标“、”评标结果公告“、“标后质疑”状态的数据
  3535. List<String> qtyy = new ArrayList<>();
  3536. qtyy.add(PmProjectStatus.EXPERT_FEEDBACK.getCode());
  3537. qtyy.add(PmProjectStatus.PROCUREMENT_ANNOUNCEMENT.getCode());
  3538. qtyy.add(PmProjectStatus.WAIT_OPEN_BID.getCode());
  3539. qtyy.add(PmProjectStatus.BID_RESULT_ANNOUNCEMENT.getCode());
  3540. qtyy.add(PmProjectStatus.POST_BID_QUERY.getCode());
  3541. pmDemandReqVo.setProjectStatusList(qtyy);
  3542. StatisticalChartsResVo resVo5 = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo);
  3543. resVo5.setColumnName("其他原因项目数量");
  3544. resVos.add(resVo5);
  3545. return AjaxResult.success(resVos);
  3546. }
  3547. @Override
  3548. public AjaxResult exceedReasonZj(PmDemandReqVo pmDemandReqVo) {
  3549. List<StatisticalChartsResVo> resVos = new ArrayList<>();
  3550. //是-1就是查询自己及子孙级以下,否则只查询指定部门
  3551. if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) {
  3552. pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId()));
  3553. } else {
  3554. pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId()));
  3555. }
  3556. //统计超过计划完成采购时间的项目中,处在各阶段的数据包括以下内容:
  3557. //1、需求编制对接数量/涉及金额:状态为“采购需求对接”的数量及预算金额
  3558. List<String> xqdj = new ArrayList<>();
  3559. xqdj.add(PmProjectStatus.PURCHASE_DEMAND_DOCKING.getCode());
  3560. pmDemandReqVo.setProjectStatusList(xqdj);
  3561. StatisticalChartsResVo resVo = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo);
  3562. resVo.setColumnName("需求编制对接数量");
  3563. resVos.add(resVo);
  3564. //2、采购文件编制审核数量/涉及金额:状态为“采购文件编制审核“的数量及预算金额
  3565. List<String> wjsh = new ArrayList<>();
  3566. wjsh.add(PmProjectStatus.PROCUREMENT_DOCUMENTS_REVIEW.getCode());
  3567. pmDemandReqVo.setProjectStatusList(wjsh);
  3568. StatisticalChartsResVo resVo2 = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo);
  3569. resVo2.setColumnName("采购文件编制审核数量");
  3570. resVos.add(resVo2);
  3571. //3、质疑、投诉、复议、信访举报数量/涉及金额:按钮”质疑投诉”进行质疑过的项目及预算金额
  3572. List<Long> demandIdAll = questionHisService.selectDemandIdAll();
  3573. pmDemandReqVo.setDemandIdAll(demandIdAll);
  3574. StatisticalChartsResVo resVo3 = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo);
  3575. resVo3.setColumnName("质疑、投诉、复议、信访举报数量");
  3576. resVos.add(resVo3);
  3577. //5、其他原因项目数量/涉及金额:统计“专家意见反馈”、“采购公告发布”、”待开标“、”评标结果公告“、“标后质疑”状态的数据
  3578. List<String> qtyy = new ArrayList<>();
  3579. qtyy.add(PmProjectStatus.EXPERT_FEEDBACK.getCode());
  3580. qtyy.add(PmProjectStatus.PROCUREMENT_ANNOUNCEMENT.getCode());
  3581. qtyy.add(PmProjectStatus.WAIT_OPEN_BID.getCode());
  3582. qtyy.add(PmProjectStatus.BID_RESULT_ANNOUNCEMENT.getCode());
  3583. qtyy.add(PmProjectStatus.POST_BID_QUERY.getCode());
  3584. pmDemandReqVo.setProjectStatusList(qtyy);
  3585. StatisticalChartsResVo resVo5 = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo);
  3586. resVo5.setColumnName("其他原因项目数量");
  3587. resVos.add(resVo5);
  3588. return AjaxResult.success(resVos);
  3589. }
  3590. @Override
  3591. public AjaxResult exceedLink(PmDemandReqVo pmDemandReqVo) {
  3592. List<StatisticalChartsResVo> resVos = new ArrayList<>();
  3593. //是-1就是查询自己及子孙级以下,否则只查询指定部门
  3594. if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) {
  3595. pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId()));
  3596. } else {
  3597. pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId()));
  3598. }
  3599. //滞留环节
  3600. //超过计划完成采购时间的各状态数量及占比统计,包括:采购需求对接、采购文件编制审核、标签质疑投诉、待开标、流废标处置、标后质疑
  3601. //1、 状态为“采购需求对接”的数量及预算金额
  3602. List<String> xqdj = new ArrayList<>();
  3603. xqdj.add(PmProjectStatus.PURCHASE_DEMAND_DOCKING.getCode());
  3604. pmDemandReqVo.setProjectStatusList(xqdj);
  3605. StatisticalChartsResVo resVo = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo);
  3606. resVo.setColumnName("采购需求对接");
  3607. resVos.add(resVo);
  3608. //2、 状态为“采购文件编制审核“的数量及预算金额
  3609. List<String> wjsh = new ArrayList<>();
  3610. wjsh.add(PmProjectStatus.PROCUREMENT_DOCUMENTS_REVIEW.getCode());
  3611. pmDemandReqVo.setProjectStatusList(wjsh);
  3612. StatisticalChartsResVo resVo2 = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo);
  3613. resVo2.setColumnName("采购文件编制审核");
  3614. resVos.add(resVo2);
  3615. //3.标前质疑
  3616. List<String> bqzy = new ArrayList<>();
  3617. bqzy.add(PmProjectStatus.PRE_BID_QUERY.getCode());
  3618. pmDemandReqVo.setProjectStatusList(bqzy);
  3619. StatisticalChartsResVo resVo3 = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo);
  3620. resVo3.setColumnName("标前质疑投诉");
  3621. resVos.add(resVo3);
  3622. //4、 待开标
  3623. List<String> dkb = new ArrayList<>();
  3624. dkb.add(PmProjectStatus.WAIT_OPEN_BID.getCode());
  3625. pmDemandReqVo.setProjectStatusList(dkb);
  3626. StatisticalChartsResVo resVo4 = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo);
  3627. resVo4.setColumnName("待开标");
  3628. resVos.add(resVo4);
  3629. //5、 流废标处置
  3630. List<String> lfb = new ArrayList<>();
  3631. lfb.add(PmProjectStatus.WASTE_BID_HANDLE.getCode());
  3632. pmDemandReqVo.setProjectStatusList(lfb);
  3633. StatisticalChartsResVo resVo5 = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo);
  3634. resVo5.setColumnName("流废标处置");
  3635. resVos.add(resVo5);
  3636. //6、 标后质疑
  3637. List<String> bhzy = new ArrayList<>();
  3638. bhzy.add(PmProjectStatus.POST_BID_QUERY.getCode());
  3639. pmDemandReqVo.setProjectStatusList(bhzy);
  3640. StatisticalChartsResVo resVo6 = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo);
  3641. resVo6.setColumnName("标后质疑");
  3642. resVos.add(resVo6);
  3643. return AjaxResult.success(resVos);
  3644. }
  3645. @Override
  3646. public AjaxResult countPurTask(PmDemandReqVo pmDemandReqVo) {
  3647. List<StatisticalChartsResVo> resVos = new ArrayList<>();
  3648. //是-1就是查询自己及子孙级以下,否则只查询指定部门
  3649. if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) {
  3650. pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId()));
  3651. } else {
  3652. pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId()));
  3653. }
  3654. //1、所属采购服务站数量
  3655. //查询现有的采购服务站
  3656. SysDictData dictData = new SysDictData();
  3657. dictData.setDictType("purchase_services");
  3658. List<SysDictData> servicesData = dictDataService.selectDictDataList(dictData);
  3659. StatisticalChartsResVo resVo = new StatisticalChartsResVo();
  3660. resVo.setColumnName("所属采购服务站数量");
  3661. resVo.setNum(servicesData.size());
  3662. resVos.add(resVo);
  3663. //2、所属采购机构--根据招标代理机构管理中的白名单数据显示
  3664. StatisticalChartsResVo resVo2 = pmDemandMapper.countBaseAgencyWithWhite();
  3665. resVo2.setColumnName("所属采购机构");
  3666. resVos.add(resVo2);
  3667. //3、新受领集中采购数量--状态为“任务待下达”之后的数据
  3668. StatisticalChartsResVo resVo3 = pmDemandMapper.JZCGnum(pmDemandReqVo);
  3669. resVo3.setColumnName("新受领集中采购数量");
  3670. resVos.add(resVo3);
  3671. //4、上年度结转任务数量 上年度“任务待下达”之后,“合同待填制”之前的状态的数据
  3672. List<String> snzj = new ArrayList<>();
  3673. snzj.add(PmProjectStatus.TASK_WAIT_RELEASE.getCode());
  3674. snzj.add(PmProjectStatus.PURCHASE_DEMAND_DOCKING.getCode());
  3675. snzj.add(PmProjectStatus.EXPERT_FEEDBACK.getCode());
  3676. snzj.add(PmProjectStatus.PROCUREMENT_DOCUMENTS_REVIEW.getCode());
  3677. snzj.add(PmProjectStatus.PROCUREMENT_ANNOUNCEMENT.getCode());
  3678. snzj.add(PmProjectStatus.PRE_BID_QUERY.getCode());
  3679. snzj.add(PmProjectStatus.WAIT_OPEN_BID.getCode());
  3680. snzj.add(PmProjectStatus.BID_RESULT_ANNOUNCEMENT.getCode());
  3681. snzj.add(PmProjectStatus.WASTE_BID_HANDLE.getCode());
  3682. pmDemandReqVo.setProjectStatusList(snzj);
  3683. StatisticalChartsResVo resVo4 = pmDemandMapper.countProjecReaAndStatus(pmDemandReqVo);
  3684. resVo4.setColumnName("上年度结转任务数量");
  3685. resVos.add(resVo4);
  3686. return AjaxResult.success(resVos);
  3687. }
  3688. @Override
  3689. public AjaxResult countMajorProjectNumCGB(PmDemandReqVo pmDemandReqVo) {
  3690. //新增执行滞后采购任务数量分析 所有的超过计划完成采购时间的数据
  3691. //是-1就是查询自己及子孙级以下,否则只查询指定部门
  3692. if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) {
  3693. pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId()));
  3694. } else {
  3695. pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId()));
  3696. }
  3697. HashMap<String, List<StatisticalChartsResVo>> resMap = new HashMap<>();
  3698. // 查询数据库中最小的年份
  3699. int minYear = pmDemandMapper.selectMinYear();
  3700. // 获取当前年份
  3701. Calendar calendar = Calendar.getInstance();
  3702. int thisYear = calendar.get(Calendar.YEAR);
  3703. List<StatisticalChartsResVo> resVos = new LinkedList<>();
  3704. for (int i = minYear; i <= thisYear; i++) {
  3705. pmDemandReqVo.setYear(i);
  3706. StatisticalChartsResVo byYear = pmDemandMapper.countProjectACT_Year(pmDemandReqVo);
  3707. resVos.add(byYear);
  3708. }
  3709. if (pmDemandReqVo.getTimeType().equals("1")) {
  3710. resMap.put("年", resVos);
  3711. } else if (pmDemandReqVo.getTimeType().equals("2")) {
  3712. List<StatisticalChartsResVo> byQuarter = new LinkedList<>();
  3713. for (StatisticalChartsResVo chartsResVo : resVos) {
  3714. pmDemandReqVo.setYear(Integer.parseInt(chartsResVo.getColumnName()));
  3715. for (int i = 1; i <= 4; i++) {
  3716. pmDemandReqVo.setQuarter(i);
  3717. StatisticalChartsResVo quarter = pmDemandMapper.countProjectACT_Qua(pmDemandReqVo);
  3718. if (ObjectUtils.isEmpty(quarter)) {
  3719. StatisticalChartsResVo vo = new StatisticalChartsResVo("", "", 0, BigDecimal.valueOf(0), BigDecimal.valueOf(0));
  3720. quarter = vo;
  3721. quarter.setColumnName(chartsResVo.getColumnName() + "年第" + i + "季度");
  3722. }
  3723. quarter.setColumnName(chartsResVo.getColumnName() + "年第" + i + "季度");
  3724. byQuarter.add(quarter);
  3725. }
  3726. }
  3727. resMap.put("季度", byQuarter);
  3728. } else if (pmDemandReqVo.getTimeType().equals("3")) {
  3729. List<StatisticalChartsResVo> byMonth = new LinkedList<>();
  3730. for (StatisticalChartsResVo chartsResVo : resVos) {
  3731. pmDemandReqVo.setYear(Integer.parseInt(chartsResVo.getColumnName()));
  3732. for (int i = 1; i <= 12; i++) {
  3733. pmDemandReqVo.setMonth(i);
  3734. StatisticalChartsResVo month = pmDemandMapper.countProjectACT_Mon(pmDemandReqVo);
  3735. if (ObjectUtils.isEmpty(month)) {
  3736. StatisticalChartsResVo vo = new StatisticalChartsResVo("", "", 0, BigDecimal.valueOf(0), BigDecimal.valueOf(0));
  3737. month = vo;
  3738. month.setColumnName(chartsResVo.getColumnName() + "年" + i + "月");
  3739. }
  3740. month.setColumnName(chartsResVo.getColumnName() + "年" + i + "月");
  3741. byMonth.add(month);
  3742. }
  3743. }
  3744. resMap.put("月", byMonth);
  3745. }
  3746. return AjaxResult.success(resMap);
  3747. }
  3748. //查询不同状态下的项目数据
  3749. public List<PmDemand> getListByStatus(String projectStatus) {
  3750. LambdaQueryWrapper<PmDemand> lw = new LambdaQueryWrapper<PmDemand>();
  3751. //需求待提交时不用查审核
  3752. if (!projectStatus.equals("5") && !projectStatus.equals("4")) {
  3753. List<PmAuditDeptRef> list = new ArrayList<>();
  3754. LambdaQueryWrapper<PmAuditDeptRef> l = new LambdaQueryWrapper<>();
  3755. l.eq(PmAuditDeptRef::getDeptId, SecurityUtils.getDeptId());
  3756. l.eq(PmAuditDeptRef::getRefType, "2");
  3757. list = pmAuditDeptRefService.list(l);
  3758. if (!ObjectUtils.isEmpty(list) && !SysUser.isAdmin(SecurityUtils.getUserId())) {
  3759. lw.in(PmDemand::getDemandId, list.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toList()));
  3760. }
  3761. }
  3762. lw.in(PmDemand::getProjectStatus, projectStatus);
  3763. lw.eq(PmDemand::getPurchaseDeptId, SecurityUtils.getDeptId());
  3764. lw.last(" order by project_status, plan_demand_sub_time");
  3765. return this.baseMapper.selectList(lw);
  3766. }
  3767. /**
  3768. * 查询不同状态下的项目数据(采购办)
  3769. * 采购执行管理中,本单位超额项目交给上级处理,本单位不处理。
  3770. *
  3771. * @param projectStatus
  3772. * @return
  3773. */
  3774. public List<PmDemand> getListByStatusCGB(String projectStatus) {
  3775. //登录用户的部门
  3776. Long deptId = SecurityUtils.getDeptId();
  3777. SysDept sysDept = deptMapper.selectDeptById(deptId);
  3778. LambdaQueryWrapper<PmDemand> lw = new LambdaQueryWrapper<PmDemand>();
  3779. List<PmAuditDeptRef> list = new ArrayList<>();
  3780. LambdaQueryWrapper<PmAuditDeptRef> l = new LambdaQueryWrapper<>();
  3781. l.eq(PmAuditDeptRef::getDeptId, deptId);
  3782. l.eq(PmAuditDeptRef::getRefType, "2");
  3783. list = pmAuditDeptRefService.list(l);
  3784. //本单位所有参与审核的项目id
  3785. List<Long> refList = list.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toList());
  3786. //替身,取交集用
  3787. List<Long> refListL = refList;
  3788. //上级参与审核的项目
  3789. List<Long> refListf = new ArrayList<>();
  3790. LambdaQueryWrapper<PmDemand> lwf = new LambdaQueryWrapper<PmDemand>();
  3791. List<PmAuditDeptRef> listf = new ArrayList<>();
  3792. if (sysDept.getParentId() != 0) {
  3793. LambdaQueryWrapper<PmAuditDeptRef> lf = new LambdaQueryWrapper<>();
  3794. lf.eq(PmAuditDeptRef::getDeptId, sysDept.getParentId());
  3795. lf.eq(PmAuditDeptRef::getRefType, "2");
  3796. listf = pmAuditDeptRefService.list(lf);
  3797. //上级参与审核的项目id
  3798. refListf = listf.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toList());
  3799. }
  3800. //取集合交集,交集中的是上级处理,本单位不处理
  3801. if (!ObjectUtils.isEmpty(refListf)) {
  3802. refListL.retainAll(refListf);
  3803. Iterator<Long> it = refList.iterator();
  3804. while (it.hasNext()) {
  3805. //只留下本单位要处理的项目
  3806. if (refListL.contains(it.next())) {
  3807. it.remove();
  3808. }
  3809. }
  3810. }
  3811. lw.in(PmDemand::getProjectStatus, projectStatus);
  3812. lw.last(" order by project_status, plan_demand_sub_time");
  3813. return this.baseMapper.selectList(lw);
  3814. }
  3815. /**
  3816. * 查询不同状态下的项目数据
  3817. * 待办事项--全部
  3818. *
  3819. * @param projectStatus
  3820. * @return
  3821. */
  3822. public List<PmDemand> getListByStatusTotal(List<String> projectStatus) {
  3823. LambdaQueryWrapper<PmDemand> lw = new LambdaQueryWrapper<PmDemand>();
  3824. List<PmAuditDeptRef> list = new ArrayList<>();
  3825. LambdaQueryWrapper<PmAuditDeptRef> l = new LambdaQueryWrapper<>();
  3826. l.eq(PmAuditDeptRef::getDeptId, SecurityUtils.getDeptId());
  3827. l.eq(PmAuditDeptRef::getRefType, "2");
  3828. list = pmAuditDeptRefService.list(l);
  3829. if (!ObjectUtils.isEmpty(list) && !SysUser.isAdmin(SecurityUtils.getUserId())) {
  3830. lw.in(PmDemand::getDemandId, list.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toList()));
  3831. }
  3832. lw.in(PmDemand::getProjectStatus, projectStatus);
  3833. lw.eq(PmDemand::getPurchaseDeptId, SecurityUtils.getDeptId());
  3834. lw.last(" order by project_status, plan_demand_sub_time");
  3835. return this.baseMapper.selectList(lw);
  3836. }
  3837. /**
  3838. * 查询不同状态下的项目数据(采购办)
  3839. * 采购执行管理中,本单位超额项目交给上级处理,本单位不处理。
  3840. * 待办事项--全部
  3841. *
  3842. * @param projectStatus
  3843. * @return
  3844. */
  3845. public List<PmDemand> getListByStatusTotalCGB(List<String> projectStatus) {
  3846. //登录用户的部门
  3847. Long deptId = SecurityUtils.getDeptId();
  3848. SysDept sysDept = deptMapper.selectDeptById(deptId);
  3849. LambdaQueryWrapper<PmDemand> lw = new LambdaQueryWrapper<PmDemand>();
  3850. List<PmAuditDeptRef> list = new ArrayList<>();
  3851. LambdaQueryWrapper<PmAuditDeptRef> l = new LambdaQueryWrapper<>();
  3852. l.eq(PmAuditDeptRef::getDeptId, deptId);
  3853. l.eq(PmAuditDeptRef::getRefType, "2");
  3854. list = pmAuditDeptRefService.list(l);
  3855. //本单位所有参与审核的项目id
  3856. List<Long> refList = list.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toList());
  3857. //替身,取交集用
  3858. List<Long> refListL = refList;
  3859. //上级参与审核的项目
  3860. List<Long> refListf = new ArrayList<>();
  3861. LambdaQueryWrapper<PmDemand> lwf = new LambdaQueryWrapper<PmDemand>();
  3862. List<PmAuditDeptRef> listf = new ArrayList<>();
  3863. if (sysDept.getParentId() != 0) {
  3864. LambdaQueryWrapper<PmAuditDeptRef> lf = new LambdaQueryWrapper<>();
  3865. lf.eq(PmAuditDeptRef::getDeptId, sysDept.getParentId());
  3866. lf.eq(PmAuditDeptRef::getRefType, "2");
  3867. listf = pmAuditDeptRefService.list(lf);
  3868. //上级参与审核的项目id
  3869. refListf = listf.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toList());
  3870. }
  3871. //取集合交集,交集中的是上级处理,本单位不处理
  3872. if (!ObjectUtils.isEmpty(refListf)) {
  3873. refListL.retainAll(refListf);
  3874. Iterator<Long> it = refList.iterator();
  3875. while (it.hasNext()) {
  3876. //只留下本单位要处理的项目
  3877. if (refListL.contains(it.next())) {
  3878. it.remove();
  3879. }
  3880. }
  3881. }
  3882. //为空就返回空
  3883. if (ObjectUtils.isEmpty(refList) && !SysUser.isAdmin(SecurityUtils.getUserId())) {
  3884. lw.in(PmDemand::getDemandId, -1);
  3885. } else if (!ObjectUtils.isEmpty(refList) && !SysUser.isAdmin(SecurityUtils.getUserId())) {
  3886. lw.in(PmDemand::getDemandId, refList);
  3887. }
  3888. lw.in(PmDemand::getProjectStatus, projectStatus);
  3889. lw.last(" order by project_status, plan_demand_sub_time");
  3890. return this.baseMapper.selectList(lw);
  3891. }
  3892. //数据转换
  3893. @Override
  3894. public List<PmDemandResVo> listToVoList(List<PmDemand> demandList) {
  3895. List<PmDemandResVo> pmDemandResponseVoList = new ArrayList<>();
  3896. if (!ObjectUtils.isEmpty(demandList) && demandList.size() > 0) {
  3897. pmDemandResponseVoList = demandChangeTo(demandList);
  3898. }
  3899. return pmDemandResponseVoList;
  3900. }
  3901. //查询不同状态下的项目数据的数量
  3902. @Override
  3903. public Integer getNumByStatus(String projectStatus) {
  3904. LambdaQueryWrapper<PmDemand> lw = new LambdaQueryWrapper<PmDemand>();
  3905. ///需求待提交时不用查审核
  3906. if (!projectStatus.equals("5") && !projectStatus.equals("4")) {
  3907. List<PmAuditDeptRef> list = new ArrayList<>();
  3908. LambdaQueryWrapper<PmAuditDeptRef> l = new LambdaQueryWrapper<>();
  3909. l.eq(PmAuditDeptRef::getDeptId, SecurityUtils.getDeptId());
  3910. l.eq(PmAuditDeptRef::getRefType, "2");
  3911. list = pmAuditDeptRefService.list(l);
  3912. if (!ObjectUtils.isEmpty(list) && !SysUser.isAdmin(SecurityUtils.getUserId())) {
  3913. lw.in(PmDemand::getDemandId, list.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toList()));
  3914. }
  3915. }
  3916. lw.eq(PmDemand::getProjectStatus, projectStatus);
  3917. lw.eq(PmDemand::getPurchaseDeptId, SecurityUtils.getDeptId());
  3918. lw.last(" order by project_status, plan_demand_sub_time");
  3919. Long count = this.baseMapper.selectCount(lw);
  3920. return Math.toIntExact(count);
  3921. }
  3922. /**
  3923. * 查询不同状态下的项目数据的数量(采购办首页)
  3924. * 采购执行管理中,本单位超额项目交给上级处理,本单位不处理。
  3925. */
  3926. @Override
  3927. public Integer getNumByStatusCGB(String projectStatus) {
  3928. //登录用户的部门
  3929. Long deptId = SecurityUtils.getDeptId();
  3930. SysDept sysDept = deptMapper.selectDeptById(deptId);
  3931. LambdaQueryWrapper<PmDemand> lw = new LambdaQueryWrapper<PmDemand>();
  3932. List<PmAuditDeptRef> list = new ArrayList<>();
  3933. LambdaQueryWrapper<PmAuditDeptRef> l = new LambdaQueryWrapper<>();
  3934. l.eq(PmAuditDeptRef::getDeptId, deptId);
  3935. l.eq(PmAuditDeptRef::getRefType, "2");
  3936. list = pmAuditDeptRefService.list(l);
  3937. //本单位所有参与审核的项目id
  3938. List<Long> refList = list.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toList());
  3939. //替身,取交集用
  3940. List<Long> refListL = refList;
  3941. //上级参与审核的项目
  3942. List<Long> refListf = new ArrayList<>();
  3943. LambdaQueryWrapper<PmDemand> lwf = new LambdaQueryWrapper<PmDemand>();
  3944. List<PmAuditDeptRef> listf = new ArrayList<>();
  3945. if (sysDept.getParentId() != 0) {
  3946. LambdaQueryWrapper<PmAuditDeptRef> lf = new LambdaQueryWrapper<>();
  3947. lf.eq(PmAuditDeptRef::getDeptId, sysDept.getParentId());
  3948. lf.eq(PmAuditDeptRef::getRefType, "2");
  3949. listf = pmAuditDeptRefService.list(lf);
  3950. //上级参与审核的项目id
  3951. refListf = listf.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toList());
  3952. }
  3953. //取集合交集,交集中的是上级处理,本单位不处理
  3954. if (!ObjectUtils.isEmpty(refListf)) {
  3955. refListL.retainAll(refListf);
  3956. Iterator<Long> it = refList.iterator();
  3957. while (it.hasNext()) {
  3958. //只留下本单位要处理的项目
  3959. if (refListL.contains(it.next())) {
  3960. it.remove();
  3961. }
  3962. }
  3963. }
  3964. //为空就返回空
  3965. if (ObjectUtils.isEmpty(refList) && !SysUser.isAdmin(SecurityUtils.getUserId())) {
  3966. lw.in(PmDemand::getDemandId, -1);
  3967. } else if (!ObjectUtils.isEmpty(refList) && !SysUser.isAdmin(SecurityUtils.getUserId())) {
  3968. lw.in(PmDemand::getDemandId, refList);
  3969. }
  3970. lw.eq(PmDemand::getProjectStatus, projectStatus);
  3971. lw.last(" order by project_status, plan_demand_sub_time");
  3972. Long count = this.baseMapper.selectCount(lw);
  3973. return Math.toIntExact(count);
  3974. }
  3975. //字段转换and赋值
  3976. public List<PmDemandResVo> demandChangeTo(List<PmDemand> pmDemandList) {
  3977. List<PmDemandResVo> pmDemandResponseVoList = new ArrayList<>();
  3978. //获取字典数据
  3979. HashMap<String, HashMap<String, String>> planEnums = dictTypeService.getAboutEnums();
  3980. //项目属性
  3981. HashMap<String, String> projectAttributes = planEnums.get("projectAttributes");
  3982. //提前或延后*天进行提醒
  3983. List<SysDictData> alertTime = dictTypeService.selectDictDataByType("alert_time_setting");
  3984. HashMap<String, String> alertTimeMap = new LinkedHashMap<>();
  3985. //根据时间类别设定的提醒时间
  3986. for (SysDictData dictData : alertTime) {
  3987. // 字段名称----阈值
  3988. alertTimeMap.put(dictData.getDictLabel(), dictData.getDictValue());
  3989. }
  3990. for (PmDemand pmDemand1 : pmDemandList) {
  3991. PmDemandResVo vo = new PmDemandResVo();
  3992. BeanUtils.copyProperties(pmDemand1, vo);
  3993. if (vo.getPurchaseDeptId() != null) {
  3994. Map<String, Object> deptMap = deptService.selectDeptById(vo.getPurchaseDeptId());
  3995. if (deptMap != null) {
  3996. SysDeptResponseVo sysDeptResponseVo = (SysDeptResponseVo) deptMap.get("sysDept");
  3997. if (sysDeptResponseVo != null) {
  3998. vo.setPurchaseDeptName(sysDeptResponseVo.getDeptName());
  3999. }
  4000. }
  4001. }
  4002. String purchaseServicesName = dictDataService.selectDictLabel("purchase_services", vo.getPurchaseServices());
  4003. if (StringUtils.isNotEmpty(purchaseServicesName)) {
  4004. vo.setPurchaseServicesName(purchaseServicesName);
  4005. }
  4006. //项目类型
  4007. for (ProjectTypes value : ProjectTypes.values()) {
  4008. if (vo.getProjectType() != null && vo.getProjectType().equals(value.getCode())) {
  4009. vo.setProjectTypeName(value.getInfo());
  4010. break;
  4011. }
  4012. }
  4013. //是否为超限额计划
  4014. for (IsExcess value : IsExcess.values()) {
  4015. if (vo.getIsExcess() != null && vo.getIsExcess().equals(value.getCode())) {
  4016. vo.setIsExcessName(value.getInfo());
  4017. break;
  4018. }
  4019. }
  4020. //采购方式
  4021. for (PlanPurchaseMode value : PlanPurchaseMode.values()) {
  4022. if (vo.getPurchaseMode() != null && vo.getPurchaseMode().equals(value.getCode())) {
  4023. vo.setPurchaseModeName(value.getInfo());
  4024. break;
  4025. }
  4026. }
  4027. //项目属性为value拼接
  4028. if (!ObjectUtils.isEmpty(vo.getProjectAttr())) {
  4029. if (vo.getProjectAttr().length() > 1) {
  4030. StringBuilder builder = new StringBuilder();
  4031. String[] split = vo.getProjectAttr().split(",");
  4032. for (String s : split) {
  4033. for (Map.Entry<String, String> entry : projectAttributes.entrySet()) {
  4034. if (s.equals(entry.getValue())) {
  4035. if (!vo.getProjectAttr().endsWith(s)) {
  4036. builder.append(entry.getKey() + ",");
  4037. } else {
  4038. builder.append(entry.getKey());
  4039. }
  4040. break;
  4041. }
  4042. }
  4043. }
  4044. vo.setProjectAttrName(builder.toString());
  4045. } else {
  4046. for (Map.Entry<String, String> entry : projectAttributes.entrySet()) {
  4047. if (vo.getProjectAttr().equals(entry.getValue())) {
  4048. vo.setProjectAttrName(entry.getKey());
  4049. break;
  4050. }
  4051. }
  4052. }
  4053. }
  4054. //预警状态
  4055. for (WarnStatus value : WarnStatus.values()) {
  4056. if (vo.getWarnStatus() != null && vo.getWarnStatus().equals(value.getCode())) {
  4057. vo.setWarnStatusName(value.getInfo());
  4058. break;
  4059. }
  4060. }
  4061. //项目状态
  4062. for (PmProjectStatus value : PmProjectStatus.values()) {
  4063. if (vo.getProjectStatus() != null && vo.getProjectStatus().equals(value.getCode())) {
  4064. vo.setProjectStatusName(value.getInfo());
  4065. break;
  4066. }
  4067. }
  4068. try {
  4069. vo.setTipsMessage(pmDemandGetTips(vo, alertTimeMap));
  4070. if (vo.getTipsMessage().contains("超过")) {
  4071. vo.setIsExceedProject("1");
  4072. if (ObjectUtils.isEmpty(pmDemand1.getDelayReason())) {
  4073. //没有原因就可以填写滞后原因
  4074. vo.setIsWriteExceed("1");
  4075. }
  4076. }
  4077. } catch (ParseException e) {
  4078. e.printStackTrace();
  4079. }
  4080. pmDemandResponseVoList.add(vo);
  4081. }
  4082. return pmDemandResponseVoList;
  4083. }
  4084. /**
  4085. * 根据年度计划提报时间的阈值进行提示
  4086. *
  4087. * @return
  4088. */
  4089. public String pmDemandGetTips(PmDemandResVo vo, HashMap<String, String> alertTimeMap) throws ParseException {
  4090. //首页待办事项--计划完成采购时间提醒
  4091. if (ObjectUtils.isEmpty(vo.getRealDemandCommitTime())) {
  4092. int alertDay2 = Integer.parseInt(alertTimeMap.get("计划提报时间"));
  4093. Integer alertTime = 1000 * 60 * 60 * 24 * alertDay2;
  4094. double surplusTwo = vo.getPlanDemandSubTime().getTime() - System.currentTimeMillis();
  4095. //少于设定阈值便提醒
  4096. if (surplusTwo < alertTime) {
  4097. //剩余天数(向上取整)
  4098. int i = (int) Math.ceil(surplusTwo / 1000 / 60 / 60 / 24);
  4099. if (i > 0) {
  4100. return "距离计划提报时间不足" + i + "天";
  4101. } else {
  4102. return "已超过计划提报时间" + Math.abs(i) + "天";
  4103. }
  4104. }
  4105. }
  4106. //首页待办事项--计划完成采购时间提醒
  4107. if (ObjectUtils.isEmpty(vo.getRealPurchaseFinishTime())) {
  4108. int alertDay2 = Integer.parseInt(alertTimeMap.get("计划完成时间"));
  4109. Integer alertTime = 1000 * 60 * 60 * 24 * alertDay2;
  4110. double surplusTwo = vo.getPlanPurchaseFinishTime().getTime() - System.currentTimeMillis();
  4111. //少于设定阈值便提醒
  4112. if (surplusTwo < alertTime) {
  4113. //剩余天数(向上取整)
  4114. int i = (int) Math.ceil(surplusTwo / 1000 / 60 / 60 / 24);
  4115. if (i > 0) {
  4116. return "距离计划完成采购时间不足" + i + "天";
  4117. } else {
  4118. return "已超过计划完成采购时间" + Math.abs(i) + "天";
  4119. }
  4120. }
  4121. }
  4122. //首页待办事项--计划交付时间提醒
  4123. if (ObjectUtils.isEmpty(vo.getRealDeliverTime())) {
  4124. Date deliverTime = vo.getPlanDeliverTime();
  4125. int alertDay = Integer.parseInt(alertTimeMap.get("计划交付(实施)时间"));
  4126. Integer remindTine = 1000 * 60 * 60 * 24 * alertDay;
  4127. double surplus = deliverTime.getTime() - System.currentTimeMillis();
  4128. if (surplus < remindTine) {
  4129. //剩余天数(向上取整)
  4130. int i = (int) Math.ceil(surplus / 1000 / 60 / 60 / 24);
  4131. if (i > 0) {
  4132. return "距离计划交付时间不足" + i + "天";
  4133. } else {
  4134. return "已超过计划交付时间" + Math.abs(i) + "天";
  4135. }
  4136. }
  4137. }
  4138. return "";
  4139. }
  4140. /**
  4141. * 计算百分比:使用java.text.DecimalFormat实现
  4142. *
  4143. * @param x
  4144. * @param y
  4145. * @return
  4146. */
  4147. public static String getPercent(int x, int y) {
  4148. double d1 = x * 1.0;
  4149. double d2 = y * 1.0;
  4150. // 设置保留几位小数, “.”后面几个零就保留几位小数,这里设置保留2位小数
  4151. DecimalFormat decimalFormat = new DecimalFormat("##.00%");
  4152. return decimalFormat.format(d1 / d2);
  4153. }
  4154. //查询本单位及本级一下全部
  4155. public List<Long> isQueryAll(Integer queryAll) {
  4156. List<Long> deptList = new ArrayList<>();
  4157. Long deptId = SecurityUtils.getDeptId();
  4158. //查询全部
  4159. if (queryAll.equals(-1)) {
  4160. //获取到子孙级部门id
  4161. if (deptService.hasChildByDeptId(SecurityUtils.getDeptId())) {
  4162. List<Long> children = deptService.getDeptChildren(deptId);
  4163. System.err.println(children.size());
  4164. deptList.addAll(children);
  4165. }
  4166. deptList.add(deptId);
  4167. }
  4168. return deptList;
  4169. }
  4170. //查询本单位还是本单位及子孙级----要查询子单位的超额数据
  4171. @Override
  4172. public List<Long> isQueryZD(Integer queryZd) {
  4173. //指定部门--以及子单位的超额数据
  4174. List<Long> demandId = new ArrayList<>();
  4175. //先获取本部门的项目
  4176. LambdaQueryWrapper<PmDemand> ld = new LambdaQueryWrapper<>();
  4177. ld.eq(PmDemand::getPurchaseDeptId, queryZd);
  4178. //本部门的项目
  4179. List<PmDemand> deList = pmDemandMapper.selectList(ld);
  4180. for (PmDemand demand : deList) {
  4181. demandId.add(demand.getDemandId());
  4182. }
  4183. if (deptService.hasChildByDeptId(Long.valueOf(queryZd))) {
  4184. //获取子级部门d
  4185. List<Long> childByDeptId = deptService.getChildIdByDeptId(Long.valueOf(queryZd));
  4186. //取出所有可以进行统计的项目id
  4187. for (Long cid : childByDeptId) {
  4188. LambdaQueryWrapper<PmAuditDeptRef> ll = new LambdaQueryWrapper<>();
  4189. ll.eq(PmAuditDeptRef::getDeptId, cid);
  4190. ll.eq(PmAuditDeptRef::getRefType, "2");
  4191. //子部门参加审核的项目
  4192. List<PmAuditDeptRef> refList = pmAuditDeptRefService.list(ll);
  4193. //同一个数据有上级参与说明是超额
  4194. for (PmAuditDeptRef ref : refList) {
  4195. //获取上级并查询是否参与审核
  4196. SysDept dept = deptService.selectByCid(ref.getDeptId());
  4197. //是否参与审核
  4198. LambdaQueryWrapper<PmAuditDeptRef> pp = new LambdaQueryWrapper<>();
  4199. ll.eq(PmAuditDeptRef::getDeptId, dept.getDeptId());
  4200. ll.eq(PmAuditDeptRef::getRefId, ref.getRefId());
  4201. //取出父级部门参加审核的项目(超额项目)
  4202. List<PmAuditDeptRef> refListP = pmAuditDeptRefService.list(pp);
  4203. if (!ObjectUtils.isEmpty(refListP)) {
  4204. demandId.add(ref.getRefId());
  4205. }
  4206. }
  4207. }
  4208. }
  4209. return demandId;
  4210. }
  4211. }