PmDemandServiceImpl.java 203 KB

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