PmDemandServiceImpl.java 205 KB

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