12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167 |
- package com.ozs.pm.service.impl;
- import java.lang.invoke.LambdaConversionException;
- import java.math.BigDecimal;
- import java.text.DecimalFormat;
- import java.text.ParseException;
- import java.util.*;
- import java.util.stream.Collectors;
- import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
- import com.baomidou.mybatisplus.core.metadata.IPage;
- import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
- import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
- import com.ozs.base.domain.*;
- import com.ozs.base.domain.vo.BaseExpertVo;
- import com.ozs.base.mapper.BaseExpertMapper;
- import com.ozs.base.service.*;
- import com.ozs.common.core.domain.AjaxResult;
- import com.ozs.common.core.domain.entity.*;
- import com.ozs.common.enums.*;
- import com.ozs.common.utils.DateUtils;
- import com.ozs.common.utils.RandomUtil;
- import com.ozs.common.utils.SecurityUtils;
- import com.ozs.common.utils.StringUtils;
- import com.ozs.common.utils.bean.BeanUtils;
- import com.ozs.home.domain.vo.HomeToDoQueryResVo;
- import com.ozs.plan.doman.vo.responseVo.PlanQuarterResponseVo;
- import com.ozs.plan.service.PlanYearsService;
- import com.ozs.pm.doman.*;
- import com.ozs.pm.doman.vo.requestVo.*;
- import com.ozs.pm.doman.vo.responseVo.*;
- import com.ozs.pm.mapper.PmDemandMapper;
- import com.ozs.pm.service.*;
- import com.ozs.system.domain.SysFileInfo;
- import com.ozs.system.domain.SysFileRef;
- import com.ozs.system.domain.vo.SysRegionVO;
- import com.ozs.system.domain.vo.responseVo.SysDeptResponseVo;
- import com.ozs.system.mapper.SysDeptMapper;
- import com.ozs.system.mapper.SysRoleMapper;
- import com.ozs.system.service.*;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import org.springframework.transaction.annotation.Transactional;
- import org.springframework.util.CollectionUtils;
- import org.springframework.util.ObjectUtils;
- /**
- * 采购需求Service业务层处理
- *
- * @author ruoyi
- * @date 2023-01-16
- */
- @Service
- @Slf4j
- public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> implements IPmDemandService {
- @Autowired
- private PmDemandMapper pmDemandMapper;
- @Autowired
- private ISysDeptService deptService;
- @Autowired
- private ISysDictDataService dictDataService;
- @Autowired
- private SysFileService fileService;
- @Autowired
- private SysFileRefService sysFileRefService;
- @Autowired
- private IPmFlowChartService iPmFlowChartService;
- @Autowired
- private PmReleaseAnnouncementService pmReleaseAnnouncementService;
- @Autowired
- private BaseExpertService baseExpertService;
- @Autowired
- private PmDemandExpertRefService pmDemandExpertRefService;
- @Autowired
- private PmBidOpeningService pmBidOpeningService;
- @Autowired
- private PmBookBuildingService pmBookBuildingService;
- @Autowired
- private PmBidWinningService pmBidWinningService;
- @Autowired
- private ISysDictTypeService iSysDictTypeService;
- @Autowired
- private PmBidFailureService pmBidFailureService;
- @Autowired
- private PmBidWinningOpeningRefService pmBidWinningOpeningRefService;
- @Autowired
- private PmContractInfoService pmContractInfoService;
- @Autowired
- private BaseAgencyService baseAgencyService;
- @Autowired
- private PmProjectConstructionService pmProjectConstructionService;
- @Autowired
- private BaseNoticeTypeService baseNoticeTypeService;
- @Autowired
- private BaseNoticeService baseNoticeService;
- @Autowired
- private PlanYearsService planYearsService;
- @Autowired
- private ISysRegionService iSysRegionService;
- @Autowired
- private SysRoleMapper sysRoleMapper;
- @Autowired
- private ISysUserService userService;
- @Autowired
- private SysDeptMapper deptMapper;
- @Autowired
- private BaseExpertMapper baseExpertMapper;
- @Autowired
- private SysProcurementStandardService sysProcurementStandardService;
- @Autowired
- private PmAuditDeptRefService pmAuditDeptRefService;
- /**
- * 查询采购需求
- *
- * @param demandId 采购需求主键
- * @return 采购需求
- */
- @Override
- public PmDemandResVo selectPmDemandByDemandId(Long demandId, String detailType) {
- PmDemand pmDemand = this.getById(demandId);
- if (pmDemand != null) {
- PmDemandResVo vo = new PmDemandResVo();
- vo.setProjectName(pmDemand.getProjectName());
- vo.setDemandId(demandId);
- if ("1".equals(detailType)) { //项目计划
- BeanUtils.copyProperties(pmDemand, vo);
- SysDeptResponseVo sysDeptResponseVo = (SysDeptResponseVo) deptService.selectDeptById(vo.getPurchaseDeptId()).get("sysDept");
- if (sysDeptResponseVo != null) {
- vo.setPurchaseDeptName(sysDeptResponseVo.getDeptName());
- }
- String purchaseServicesName = dictDataService.selectDictLabel("purchase_services", vo.getPurchaseServices());
- if (StringUtils.isNotEmpty(purchaseServicesName)) {
- vo.setPurchaseServicesName(purchaseServicesName);
- }
- //采购需求附件
- List<SysFileInfo> demandFileInfos = getSysFileInfoList(vo.getDemandId(), SysFileRefEnum.PM_DEMAND.getType());
- if (!ObjectUtils.isEmpty(demandFileInfos)) {
- List<SysFileInfo> sysFileInfoList = getSysFileInfoList(vo.getDemandId(), SysFileRefEnum.PM_DEMAND_EXAMINE.getType());
- if (!ObjectUtils.isEmpty(sysFileInfoList)) {
- demandFileInfos.addAll(sysFileInfoList);
- }
- vo.setDemandFileInfos(demandFileInfos);
- }
- //项目类型
- for (ProjectTypes value : ProjectTypes.values()) {
- if (vo.getProjectType() != null && vo.getProjectType().equals(value.getCode())) {
- vo.setProjectTypeName(value.getInfo());
- break;
- }
- }
- //是否为超限额计划
- for (IsExcess value : IsExcess.values()) {
- if (vo.getIsExcess() != null && vo.getIsExcess().equals(value.getCode())) {
- vo.setIsExcessName(value.getInfo());
- break;
- }
- }
- //采购方式
- for (PlanPurchaseMode value : PlanPurchaseMode.values()) {
- if (vo.getPurchaseMode() != null && vo.getPurchaseMode().equals(value.getCode())) {
- vo.setPurchaseModeName(value.getInfo());
- break;
- }
- }
- //项目属性
- for (ProjectAttribute value : ProjectAttribute.values()) {
- if (vo.getProjectAttr() != null && vo.getProjectAttr().equals(value.getCode())) {
- vo.setProjectAttrName(value.getInfo());
- break;
- }
- }
- //预警状态
- for (WarnStatus value : WarnStatus.values()) {
- if (vo.getWarnStatus() != null && vo.getWarnStatus().equals(value.getCode())) {
- vo.setWarnStatusName(value.getInfo());
- break;
- }
- }
- //项目状态
- for (PmProjectStatus value : PmProjectStatus.values()) {
- if (vo.getProjectStatus() != null && vo.getProjectStatus().equals(value.getCode())) {
- vo.setProjectStatusName(value.getInfo());
- break;
- }
- }
- } else if ("2".equals(detailType)) { //需求建档
- //采购需求审核文件
- List<SysFileInfo> auditFileInfos = getSysFileInfoList(vo.getDemandId(), SysFileRefEnum.PM_DEMAND_EXAMINE.getType());
- if (!ObjectUtils.isEmpty(auditFileInfos)) {
- vo.setAuditFileInfos(auditFileInfos);
- }
- LambdaQueryWrapper<PmBookBuilding> lambdaQueryWrapper = new LambdaQueryWrapper<>();
- lambdaQueryWrapper.eq(PmBookBuilding::getDemandId, demandId);
- PmBookBuilding pmBookBuilding = pmBookBuildingService.getOne(lambdaQueryWrapper);
- if (pmBookBuilding != null) {
- PmBookBuildingResVo responseVo = new PmBookBuildingResVo();
- BeanUtils.copyProperties(pmBookBuilding, responseVo);
- List<SysFileInfo> fileInfos = getSysFileInfoList(pmBookBuilding.getId(), SysFileRefEnum.PM_BOOK_BUILDING.getType());
- if (!ObjectUtils.isEmpty(fileInfos)) {
- if (!ObjectUtils.isEmpty(auditFileInfos)) {
- fileInfos.addAll(auditFileInfos);
- }
- responseVo.setFileInfos(fileInfos);
- }
- vo.setPmBookBuildingResVo(responseVo);
- }
- } else if ("3".equals(detailType)) { //任务下达
- //任务下达文件
- List<SysFileInfo> taskReleaseFileInfos = getSysFileInfoList(vo.getDemandId(), SysFileRefEnum.PM_TAST_RELEASE.getType());
- if (!ObjectUtils.isEmpty(taskReleaseFileInfos)) {
- vo.setTaskReleaseFileInfos(taskReleaseFileInfos);
- }
- } else if ("4".equals(detailType)) { //中标信息
- PmPurchaseExecutionResVo pmPurchaseExecutionResVo = new PmPurchaseExecutionResVo();
- List<SysFileInfo> fileInfosAll = new ArrayList<>();
- //代理商信息
- BaseAgency baseAgency = this.baseAgencyService.getById(pmDemand.getAgencyId());
- pmPurchaseExecutionResVo.setBaseAgency(baseAgency);
- //发布公告列表
- LambdaQueryWrapper<PmReleaseAnnouncement> lambdaQueryWrapper = new LambdaQueryWrapper<>();
- lambdaQueryWrapper.eq(PmReleaseAnnouncement::getDemandId, demandId);
- List<PmReleaseAnnouncement> pmReleaseAnnouncementList = this.pmReleaseAnnouncementService.list(lambdaQueryWrapper);
- if (!ObjectUtils.isEmpty(pmReleaseAnnouncementList)) {
- List<PmReleaseAnnouncementResVo> pmReleaseAnnouncementResVoList = new ArrayList<>();
- for (PmReleaseAnnouncement pmReleaseAnnouncement : pmReleaseAnnouncementList) {
- PmReleaseAnnouncementResVo pmReleaseAnnouncementResVo = new PmReleaseAnnouncementResVo();
- BeanUtils.copyProperties(pmReleaseAnnouncement, pmReleaseAnnouncementResVo);
- List<SysFileInfo> fileInfos = getSysFileInfoList(pmReleaseAnnouncement.getId(), SysFileRefEnum.PM_ANNOUNCEMENT_FILE.getType());
- if (!ObjectUtils.isEmpty(fileInfos)) {
- fileInfosAll.addAll(fileInfos);
- }
- pmReleaseAnnouncementResVoList.add(pmReleaseAnnouncementResVo);
- }
- pmPurchaseExecutionResVo.setPmReleaseAnnouncementResVoList(pmReleaseAnnouncementResVoList);
- }
- //专家信息列表
- List<PmBaseExpertResVo> pmBaseExpertResVoList = this.pmDemandExpertRefService.getPmBaseExpertResVoList(demandId);
- pmPurchaseExecutionResVo.setPmBaseExpertResVoList(pmBaseExpertResVoList);
- //开标信息列表
- List<PmBidOpeningResVo> pmBidOpeningResVoList = this.pmBidOpeningService.getPmBidOpeningResVoList(demandId);
- pmPurchaseExecutionResVo.setPmBidOpeningResVoList(pmBidOpeningResVoList);
- //中标信息列表
- LambdaQueryWrapper<PmBidWinning> lambdaQueryWrapper1 = new LambdaQueryWrapper<>();
- lambdaQueryWrapper1.eq(PmBidWinning::getDemandId, demandId)
- .eq(PmBidWinning::getStatus, BidWinningStatus.NORMAL.getCode());
- PmBidWinning pmBidWinning = this.pmBidWinningService.getOne(lambdaQueryWrapper1);
- if (!ObjectUtils.isEmpty(pmBidWinning)) {
- LambdaQueryWrapper<PmBidWinningOpeningRef> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
- lambdaQueryWrapper2.eq(PmBidWinningOpeningRef::getWinningId, pmBidWinning.getId())
- .eq(PmBidWinningOpeningRef::getStatus, BidWinningStatus.NORMAL.getCode());
- List<PmBidWinningOpeningRef> pmBidWinningOpeningRefList = this.pmBidWinningOpeningRefService.list(lambdaQueryWrapper2);
- if (!ObjectUtils.isEmpty(pmBidWinningOpeningRefList)) {
- List<PmBidWinningResVo> pmBidWinningResVoList = new ArrayList<>();
- for (PmBidWinningOpeningRef pmBidWinningOpeningRef : pmBidWinningOpeningRefList) {
- PmBidOpening pmBidOpening = this.pmBidOpeningService.getById(pmBidWinningOpeningRef.getOpeningId());
- if (pmBidOpening != null) {
- PmBidWinningResVo pmBidWinningResVo = new PmBidWinningResVo();
- BeanUtils.copyProperties(pmBidWinning, pmBidWinningResVo);
- pmBidWinningResVo.setBidWinningName(pmBidOpening.getBidderName());
- List<SysFileInfo> fileInfos = getSysFileInfoList(pmBidWinning.getId(), SysFileRefEnum.PM_BID_WINNING_FILE.getType());
- if (!ObjectUtils.isEmpty(fileInfos)) {
- fileInfosAll.addAll(fileInfos);
- }
- pmBidWinningResVoList.add(pmBidWinningResVo);
- }
- }
- pmPurchaseExecutionResVo.setPmBidWinningResVoList(pmBidWinningResVoList);
- }
- }
- pmPurchaseExecutionResVo.setCallQuestion(pmDemand.getCallQuestion());
- //质疑情况
- List<SysFileInfo> callRequestFileInfos = getSysFileInfoList(vo.getDemandId(), SysFileRefEnum.PM_BID_CALL_QEUSTION_FILE.getType());
- if (!ObjectUtils.isEmpty(callRequestFileInfos)) {
- pmPurchaseExecutionResVo.setCallRequestFileInfos(callRequestFileInfos);
- }
- //流标情况
- LambdaQueryWrapper<PmBidFailure> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
- lambdaQueryWrapper2.eq(PmBidFailure::getDemandId, demandId).orderByDesc(PmBidFailure::getBidFailureTime);
- List<PmBidFailure> pmBidFailureList = this.pmBidFailureService.list(lambdaQueryWrapper2);
- if (!ObjectUtils.isEmpty(pmBidFailureList)) {
- List<PmBidFailureResVo> pmBidFailureResVoList = new ArrayList<>();
- for (PmBidFailure pmBidFailure : pmBidFailureList) {
- PmBidFailureResVo pmBidFailureResVo = new PmBidFailureResVo();
- BeanUtils.copyProperties(pmBidFailure, pmBidFailureResVo);
- List<SysFileInfo> fileInfos = getSysFileInfoList(pmBidFailure.getId(), SysFileRefEnum.PM_BID_FAILURE_FILE.getType());
- if (!ObjectUtils.isEmpty(fileInfos)) {
- fileInfosAll.addAll(fileInfos);
- }
- pmBidFailureResVoList.add(pmBidFailureResVo);
- }
- pmPurchaseExecutionResVo.setPmBidFailureResVoList(pmBidFailureResVoList);
- }
- //中标通知书
- List<SysFileInfo> pmBidWinningNotificationFileInfos = getSysFileInfoList(vo.getDemandId(), SysFileRefEnum.PM_BID_WINNING_NOTIFICATION.getType());
- if (!ObjectUtils.isEmpty(pmBidWinningNotificationFileInfos)) {
- fileInfosAll.addAll(pmBidWinningNotificationFileInfos);
- }
- pmPurchaseExecutionResVo.setFileInfos(fileInfosAll);
- vo.setPmPurchaseExecutionResVo(pmPurchaseExecutionResVo);
- } else if ("5".equals(detailType)) { //合同信息
- LambdaQueryWrapper<PmContractInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
- lambdaQueryWrapper.eq(PmContractInfo::getDemandId, demandId);
- PmContractInfo pmContractInfo = pmContractInfoService.getOne(lambdaQueryWrapper);
- if (pmContractInfo != null) {
- PmContractInfoResVo pmContractInfoResVo = new PmContractInfoResVo();
- BeanUtils.copyProperties(pmContractInfo, pmContractInfoResVo);
- //合同信息文件
- List<SysFileInfo> fileInfos = getSysFileInfoList(pmContractInfo.getId(), SysFileRefEnum.PM_CONTRACT_INFO.getType());
- if (!ObjectUtils.isEmpty(fileInfos)) {
- pmContractInfoResVo.setFileInfos(fileInfos);
- }
- vo.setPmContractInfoResVo(pmContractInfoResVo);
- }
- } else if ("6".equals(detailType)) { //建设情况
- LambdaQueryWrapper<PmProjectConstruction> lambdaQueryWrapper = new LambdaQueryWrapper<>();
- lambdaQueryWrapper.eq(PmProjectConstruction::getDemandId, demandId);
- PmProjectConstruction pmProjectConstruction = pmProjectConstructionService.getOne(lambdaQueryWrapper);
- if (pmProjectConstruction != null) {
- PmProjectConstructionResVo pmProjectConstructionResVo = new PmProjectConstructionResVo();
- BeanUtils.copyProperties(pmProjectConstruction, pmProjectConstructionResVo);
- //建设情况文件
- List<SysFileInfo> fileInfos = getSysFileInfoList(pmProjectConstruction.getId(), SysFileRefEnum.PM_PROJECT_CONSTRUCTION.getType());
- if (!ObjectUtils.isEmpty(fileInfos)) {
- pmProjectConstructionResVo.setFileInfos(fileInfos);
- }
- vo.setPmProjectConstructionResVo(pmProjectConstructionResVo);
- }
- }
- return vo;
- } else {
- return null;
- }
- }
- /**
- * 查询采购需求列表
- *
- * @param pmDemandReqVo
- * @return 采购需求
- */
- @Override
- public IPage<PmDemandResVo> selectPmDemandList(PmDemandReqVo pmDemandReqVo, int reqType) {
- LambdaQueryWrapper<PmDemand> lw = new LambdaQueryWrapper<>();
- // 4 (合同信息管理)、 0(需求单位管理) 、 5(项目建设管理) 需求单位
- // 1(需求需求审核) 、2 (任务下达管理) 采购管理部门
- // 3(采购执行管理) 采购办
- List<PmAuditDeptRef> list = new ArrayList<>();
- LambdaQueryWrapper<PmAuditDeptRef> l = new LambdaQueryWrapper<>();
- l.eq(PmAuditDeptRef::getDeptId, SecurityUtils.getDeptId());
- l.eq(PmAuditDeptRef::getRefType, "2");
- list = pmAuditDeptRefService.list(l);
- if (!pmDemandReqVo.getIsAdmin()) {
- if (Arrays.asList(1, 2, 3).contains(reqType)) {
- if (!ObjectUtils.isEmpty(list) && !SecurityUtils.getUserId().equals(Integer.parseInt("1"))) {
- lw.in(PmDemand::getDemandId, list.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toList()));
- }
- } else {
- lw.eq(PmDemand::getPurchaseDeptId, SecurityUtils.getDeptId());
- }
- }
- if (!StringUtils.isBlank(pmDemandReqVo.getProjectName())) {
- lw.like(PmDemand::getProjectName, "%" + pmDemandReqVo.getProjectName() + "%");
- }
- if (!StringUtils.isBlank(pmDemandReqVo.getPurchaseServices())) {
- lw.eq(PmDemand::getPurchaseServices, pmDemandReqVo.getPurchaseServices());
- }
- if (!ObjectUtils.isEmpty(pmDemandReqVo.getProjectStatus())) {
- lw.eq(PmDemand::getProjectStatus, pmDemandReqVo.getProjectStatus());
- }
- if (!ObjectUtils.isEmpty(pmDemandReqVo.getWarnStatus())) {
- lw.eq(PmDemand::getWarnStatus, pmDemandReqVo.getWarnStatus());
- }
- if (!ObjectUtils.isEmpty(pmDemandReqVo.getIsExcess())) {
- lw.eq(PmDemand::getIsExcess, pmDemandReqVo.getIsExcess());
- }
- if (!StringUtils.isBlank(pmDemandReqVo.getBeginDate())) {
- lw.apply("(plan_demand_sub_time >= '" + pmDemandReqVo.getBeginDate() + "' or plan_purchase_finish_time >= '" + pmDemandReqVo.getBeginDate() + "' or plan_deliver_time >= '" + pmDemandReqVo.getBeginDate() + "' )");
- }
- if (!StringUtils.isBlank(pmDemandReqVo.getEndDate())) {
- lw.apply("(plan_demand_sub_time <= '" + pmDemandReqVo.getEndDate() + "' or plan_purchase_finish_time <= '" + pmDemandReqVo.getEndDate() + "' or plan_deliver_time <= '" + pmDemandReqVo.getEndDate() + "' )");
- }
- if (reqType == 1) { //需求审核单位列表
- lw.apply("(project_status = 6 or project_status = 8 )");
- } else if (reqType == 2) { //任务下达列表
- lw.apply("(project_status = 8 or project_status = 9 )");
- } else if (reqType == 3) { //采购执行列表
- lw.apply("(project_status = 9 or project_status = 10 or project_status = 11 or project_status = 12 or project_status = 13 or project_status = 14 or project_status = 15)");
- } else if (reqType == 4) { //合同信息列表
- lw.apply("(project_status = 15 or project_status = 16 )");
- } else if (reqType == 5) { //项目建设列表
- lw.apply("(project_status = 16 or project_status = 17 )");
- }
- lw.last(" order by project_status, plan_demand_sub_time");
- IPage<PmDemand> pageRes = this.page(new Page<>(pmDemandReqVo.getPageNum(), pmDemandReqVo.getPageSize()), lw);
- IPage<PmDemandResVo> results = new Page<>(pageRes.getCurrent(), pageRes.getSize(), pageRes.getTotal());
- if (pageRes.getRecords() != null && pageRes.getRecords().size() > 0) {
- List<PmDemandResVo> pmDemandResVos = demandChangeTo(pageRes.getRecords());
- for (PmDemandResVo vo : pmDemandResVos) {
- if (Arrays.asList(1, 2, 3).contains(reqType)) {
- // 根据项目id 和 部门id 和 参数类型 获取 部门级别
- List<PmAuditDeptRef> collect = list.stream()
- .filter(o -> o.getRefId().equals(vo.getDemandId()))
- .collect(Collectors.toList());
- if (!ObjectUtils.isEmpty(collect)) {
- String deptLevel = collect.get(0).getDeptLevel();
- // 根据项目id 和 参数类型 获取 所有审核数据
- LambdaQueryWrapper<PmAuditDeptRef> ll = new LambdaQueryWrapper<>();
- ll.eq(PmAuditDeptRef::getRefId, vo.getDemandId());
- ll.eq(PmAuditDeptRef::getRefType, "2");
- List<PmAuditDeptRef> listl = pmAuditDeptRefService.list(l);
- // 判断当前用户是否有审核权限
- boolean flay = true;
- List<PmAuditDeptRef> collect1 = listl.stream()
- .filter(pmAuditDeptRef -> pmAuditDeptRef.getRefId().equals(vo.getDemandId()))
- .collect(Collectors.toList());
- for (PmAuditDeptRef pmAuditDeptRef : collect1) {
- if (pmAuditDeptRef.getDeptLevel().compareTo(deptLevel) > 0
- && pmAuditDeptRef.getStatus().equals(Integer.parseInt("0"))) {
- flay = false;
- } else if (pmAuditDeptRef.getDeptLevel().compareTo(deptLevel) == 0
- && pmAuditDeptRef.getStatus().equals(Integer.parseInt("1"))) {
- flay = false;
- }
- }
- vo.setFlay(flay);
- }
- }
- }
- results.setRecords(pmDemandResVos);
- }
- return results;
- }
- /**
- * 需求建档
- *
- * @param vo 采购需求
- * @return 结果
- */
- @Override
- @Transactional(rollbackFor = Exception.class)
- public boolean bookBuilding(PmBookBuildingReqVo vo) throws Exception {
- PmDemand pmDemand = this.getById(vo.getDemandId());
- LambdaQueryWrapper<PmBookBuilding> lambdaQueryWrapper = new LambdaQueryWrapper<>();
- lambdaQueryWrapper.eq(PmBookBuilding::getDemandId, vo.getDemandId());
- PmBookBuilding pmBookBuilding = pmBookBuildingService.getOne(lambdaQueryWrapper);
- if (pmBookBuilding != null) {
- vo.setId(pmBookBuilding.getId());
- BeanUtils.copyProperties(vo, pmBookBuilding);
- pmBookBuilding.setUpdateBy(vo.getUpdateBy());
- pmBookBuilding.setUpdateTime(new Date());
- } else {
- pmBookBuilding = new PmBookBuilding();
- BeanUtils.copyProperties(vo, pmBookBuilding);
- pmBookBuilding.setCreateBy(vo.getUpdateBy());
- pmBookBuilding.setCreateTime(new Date());
- pmBookBuilding.setUpdateBy(vo.getUpdateBy());
- pmBookBuilding.setUpdateTime(pmBookBuilding.getCreateTime());
- }
- if (pmBookBuildingService.saveOrUpdate(pmBookBuilding)) {
- List<SysFileRef> sysFileRefs = vo.getSysFileRefs();
- uploadFile(pmBookBuilding.getId(), SysFileRefEnum.PM_BOOK_BUILDING.getType(), sysFileRefs, vo.getUpdateBy());
- pmDemand.setProjectStatus(PmProjectStatus.DEMAND_WAIT_COMMIT.getCode());
- pmDemand.setUpdateBy(vo.getUpdateBy());
- pmDemand.setUpdateTime(DateUtils.getNowDate());
- return this.updateById(pmDemand);
- } else {
- return false;
- }
- }
- private List<SysFileInfo> getSysFileInfoList(Long redId, Integer type) {
- HashMap<String, Object> map = new HashMap<>();
- map.put("red_id", redId);
- map.put("type", type);
- List<SysFileRef> fileRefs = sysFileRefService.listByMap(map);
- if (!ObjectUtils.isEmpty(fileRefs)) {
- List<SysFileInfo> fileInfos = new ArrayList<>();
- for (SysFileRef ref : fileRefs) {
- SysFileInfo fileInfo = fileService.getById(ref.getFileId());
- fileInfos.add(fileInfo);
- }
- return fileInfos;
- } else {
- return null;
- }
- }
- /**
- * 查看流程图
- *
- * @param demandId 采购需求主键
- * @return 采购需求
- */
- @Override
- public Object viewFlowChart(Long demandId) {
- PmDemand pmDemand = this.getById(demandId);
- String projectStatus = String.valueOf(pmDemand.getProjectStatus());
- String moduleName = null;
- if (PmProjectStatus.DEMAND_WAIT_FILL.getCode().equals(projectStatus) || PmProjectStatus.DEMAND_AUDIT_RETURN.getCode().equals(projectStatus)) {
- moduleName = "需求填制";
- } else if (PmProjectStatus.DEMAND_WAIT_COMMIT.getCode().equals(projectStatus)) {
- moduleName = "需求提交";
- } else if (PmProjectStatus.DEMAND_WAIT_AUDIT.getCode().equals(projectStatus)) {
- moduleName = "需求审核";
- } else if (PmProjectStatus.TASK_WAIT_RELEASE.getCode().equals(projectStatus)) {
- moduleName = "任务下达";
- } else if (PmProjectStatus.WAIT_SELECT_AGENT.getCode().equals(projectStatus)) {
- moduleName = "选取代理";
- } else if (PmProjectStatus.WAIT_UPLOAD_BID_FILE.getCode().equals(projectStatus)) {
- moduleName = "上传招标文件";
- } else if (PmProjectStatus.WAIT_ANNOUNCEMENT.getCode().equals(projectStatus)) {
- moduleName = "发布公告";
- } else if (PmProjectStatus.WAIT_OPEN_BID.getCode().equals(projectStatus)) {
- moduleName = "填写专家信息,填写开标信息";
- } else if (PmProjectStatus.WAIT_BID_ANNOUNCEMENT.getCode().equals(projectStatus)) {
- moduleName = "填写中标信息";
- } else if (PmProjectStatus.BIDDING_PUBLICITY.getCode().equals(projectStatus)) {
- moduleName = "质疑处理,上传中标通知书";
- } else if (PmProjectStatus.CONTRACT_WAIT_FILL.getCode().equals(projectStatus)) {
- moduleName = "合同填制";
- } else if (PmProjectStatus.UNDER_CONSTRUCTION.getCode().equals(projectStatus)) {
- moduleName = "建设文档填制";
- } else if (PmProjectStatus.COMPLETION_CONSTRUCTION.getCode().equals(projectStatus)) {
- moduleName = "项目归档";
- }
- return moduleName;
- }
- @Override
- public PmFlowChartResVo getModuleInfo(Long demandId, String moduleName) {
- LambdaQueryWrapper<PmFlowChart> lambdaQueryWrapper = new LambdaQueryWrapper<>();
- lambdaQueryWrapper.eq(PmFlowChart::getModuleName, moduleName);
- PmFlowChart pmFlowChart = iPmFlowChartService.getOne(lambdaQueryWrapper);
- if (pmFlowChart == null) {
- return null;
- }
- PmFlowChartResVo vo = new PmFlowChartResVo();
- BeanUtils.copyProperties(pmFlowChart, vo);
- if ("需求填制".equals(moduleName)) {
- List<SysFileInfo> fileInfos = getSysFileInfoList(demandId, SysFileRefEnum.PM_DEMAND.getType());
- if (!ObjectUtils.isEmpty(fileInfos)) {
- vo.setFileInfos(fileInfos);
- }
- } else if ("需求提交".equals(moduleName)) {
- LambdaQueryWrapper<PmBookBuilding> pmBookBuildingLambdaQueryWrapper = new LambdaQueryWrapper<>();
- pmBookBuildingLambdaQueryWrapper.eq(PmBookBuilding::getDemandId, demandId);
- PmBookBuilding pmBookBuilding = pmBookBuildingService.getOne(pmBookBuildingLambdaQueryWrapper);
- if (pmBookBuilding != null) {
- List<SysFileInfo> fileInfos = getSysFileInfoList(pmBookBuilding.getId(), SysFileRefEnum.PM_BOOK_BUILDING.getType());
- if (!ObjectUtils.isEmpty(fileInfos)) {
- vo.setFileInfos(fileInfos);
- }
- }
- } else if ("需求审核".equals(moduleName)) {
- List<SysFileInfo> fileInfos = getSysFileInfoList(demandId, SysFileRefEnum.PM_DEMAND_EXAMINE.getType());
- if (!ObjectUtils.isEmpty(fileInfos)) {
- vo.setFileInfos(fileInfos);
- }
- } else if ("任务下达".equals(moduleName)) {
- List<SysFileInfo> fileInfos = getSysFileInfoList(demandId, SysFileRefEnum.PM_TAST_RELEASE.getType());
- if (!ObjectUtils.isEmpty(fileInfos)) {
- vo.setFileInfos(fileInfos);
- }
- } else if ("选取代理".equals(moduleName)) {
- //do nothing
- } else if ("上传招标文件".equals(moduleName)) {
- List<SysFileInfo> fileInfos = getSysFileInfoList(demandId, SysFileRefEnum.PM_BID_FILE.getType());
- if (!ObjectUtils.isEmpty(fileInfos)) {
- vo.setFileInfos(fileInfos);
- }
- } else if ("发布公告".equals(moduleName)) {
- LambdaQueryWrapper<PmReleaseAnnouncement> pmReleaseAnnouncementLambdaQueryWrapper = new LambdaQueryWrapper<>();
- pmReleaseAnnouncementLambdaQueryWrapper.eq(PmReleaseAnnouncement::getDemandId, demandId);
- List<PmReleaseAnnouncement> pmReleaseAnnouncementList = pmReleaseAnnouncementService.list(pmReleaseAnnouncementLambdaQueryWrapper);
- if (!ObjectUtils.isEmpty(pmReleaseAnnouncementList)) {
- List<SysFileInfo> listAll = new ArrayList<>();
- for (PmReleaseAnnouncement pmReleaseAnnouncement : pmReleaseAnnouncementList) {
- List<SysFileInfo> fileInfos = getSysFileInfoList(pmReleaseAnnouncement.getId(), SysFileRefEnum.PM_ANNOUNCEMENT_FILE.getType());
- if (!ObjectUtils.isEmpty(fileInfos)) {
- listAll.addAll(fileInfos);
- }
- }
- if (!ObjectUtils.isEmpty(listAll)) {
- vo.setFileInfos(listAll);
- }
- }
- } else if ("填写专家信息".equals(moduleName)) {
- //do nothing
- } else if ("填写开标信息".equals(moduleName)) {
- //do nothing
- } else if ("填写中标信息".equals(moduleName)) {
- List<SysFileInfo> listAll = new ArrayList<>();
- LambdaQueryWrapper<PmBidWinning> pmBidWinningLambdaQueryWrapper = new LambdaQueryWrapper<>();
- pmBidWinningLambdaQueryWrapper.eq(PmBidWinning::getDemandId, demandId);
- List<PmBidWinning> pmBidWinningList = pmBidWinningService.list(pmBidWinningLambdaQueryWrapper);
- if (!ObjectUtils.isEmpty(pmBidWinningList)) {
- for (PmBidWinning pmBidWinning : pmBidWinningList) {
- List<SysFileInfo> fileInfos = getSysFileInfoList(pmBidWinning.getId(), SysFileRefEnum.PM_BID_WINNING_FILE.getType());
- if (!ObjectUtils.isEmpty(fileInfos)) {
- listAll.addAll(fileInfos);
- }
- }
- }
- LambdaQueryWrapper<PmBidFailure> pmBidFailureLambdaQueryWrapper = new LambdaQueryWrapper<>();
- pmBidFailureLambdaQueryWrapper.eq(PmBidFailure::getDemandId, demandId);
- List<PmBidFailure> pmBidFailureList = pmBidFailureService.list(pmBidFailureLambdaQueryWrapper);
- if (!ObjectUtils.isEmpty(pmBidFailureService)) {
- for (PmBidFailure pmBidFailure : pmBidFailureList) {
- List<SysFileInfo> fileInfos = getSysFileInfoList(pmBidFailure.getId(), SysFileRefEnum.PM_BID_FAILURE_FILE.getType());
- if (!ObjectUtils.isEmpty(fileInfos)) {
- listAll.addAll(fileInfos);
- }
- }
- }
- if (!ObjectUtils.isEmpty(listAll)) {
- vo.setFileInfos(listAll);
- }
- } else if ("质疑处理".equals(moduleName)) {
- List<SysFileInfo> fileInfos = getSysFileInfoList(demandId, SysFileRefEnum.PM_BID_CALL_QEUSTION_FILE.getType());
- if (!ObjectUtils.isEmpty(fileInfos)) {
- vo.setFileInfos(fileInfos);
- }
- } else if ("上传中标通知书".equals(moduleName)) {
- List<SysFileInfo> fileInfos = getSysFileInfoList(demandId, SysFileRefEnum.PM_BID_WINNING_NOTIFICATION.getType());
- if (!ObjectUtils.isEmpty(fileInfos)) {
- vo.setFileInfos(fileInfos);
- }
- } else if ("合同填制".equals(moduleName)) {
- LambdaQueryWrapper<PmContractInfo> pmContractInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
- pmContractInfoLambdaQueryWrapper.eq(PmContractInfo::getDemandId, demandId);
- PmContractInfo pmContractInfo = pmContractInfoService.getOne(pmContractInfoLambdaQueryWrapper);
- if (pmContractInfo != null) {
- List<SysFileInfo> fileInfos = getSysFileInfoList(pmContractInfo.getId(), SysFileRefEnum.PM_CONTRACT_INFO.getType());
- if (!ObjectUtils.isEmpty(fileInfos)) {
- vo.setFileInfos(fileInfos);
- }
- }
- } else if ("建设文档填制".equals(moduleName)) {
- LambdaQueryWrapper<PmProjectConstruction> pmProjectConstructionLambdaQueryWrapper = new LambdaQueryWrapper<>();
- pmProjectConstructionLambdaQueryWrapper.eq(PmProjectConstruction::getDemandId, demandId);
- PmProjectConstruction pmProjectConstruction = pmProjectConstructionService.getOne(pmProjectConstructionLambdaQueryWrapper);
- if (pmProjectConstruction != null) {
- List<SysFileInfo> fileInfos = getSysFileInfoList(pmProjectConstruction.getId(), SysFileRefEnum.PM_PROJECT_CONSTRUCTION.getType());
- if (!ObjectUtils.isEmpty(fileInfos)) {
- vo.setFileInfos(fileInfos);
- }
- }
- } else if ("项目归档".equals(moduleName)) {
- //do nothing
- }
- return vo;
- }
- /**
- * 提交采购需求
- *
- * @param pmDemandReqVo
- * @return 结果
- */
- @Override
- @Transactional(rollbackFor = Exception.class)
- public boolean commit(PmDemandReqVo pmDemandReqVo) {
- PmDemand pmDemand = this.getById(pmDemandReqVo.getDemandId());
- SysUser sysUser = userService.selectUserById(SecurityUtils.getUserId());
- Long deptId = sysUser.getDeptId();
- SysDept sysDept = deptMapper.selectDeptById(deptId);
- pmAuditDeptRefService.insertPmAuditDeptRefs(pmDemandReqVo.getDemandId()
- , "2"
- , deptId
- , BigDecimal.valueOf(pmDemand.getEvaluation())
- , sysUser.getUserId()
- , pmDemand.getProjectType());
- PmDemand pmDemandUpdate = new PmDemand();
- pmDemandUpdate.setDemandId(pmDemand.getDemandId());
- pmDemandUpdate.setProjectStatus(PmProjectStatus.DEMAND_WAIT_AUDIT.getCode());
- pmDemandUpdate.setRealDemandCommitTime(DateUtils.getNowDate());
- pmDemandUpdate.setUpdateBy(pmDemandReqVo.getUpdateBy());
- pmDemandUpdate.setUpdateTime(DateUtils.getNowDate());
- return this.updateById(pmDemandUpdate);
- }
- /**
- * 审核采购需求通过
- *
- * @param pmDemandReqVo
- * @return 结果
- */
- @Override
- @Transactional(rollbackFor = Exception.class)
- public boolean reviewTo(PmDemandReqVo pmDemandReqVo) {
- PmDemand pmDemand = this.getById(pmDemandReqVo.getDemandId());
- PmDemand pmDemandUpdate = new PmDemand();
- pmDemandUpdate.setDemandId(pmDemand.getDemandId());
- SysUser sysUser = userService.selectUserById(SecurityUtils.getUserId());
- Long deptId = sysUser.getDeptId();
- SysDept sysDept = deptMapper.selectDeptById(deptId);
- String[] ancestors = sysDept.getAncestors().split(",");
- String deptLevel = null;
- if (ancestors.length == 2) { //C级
- deptLevel = "C";
- } else if (ancestors.length == 3) { //B级
- deptLevel = "B";
- } else if (ancestors.length == 4) { //A级
- deptLevel = "A";
- }
- LambdaQueryWrapper<PmAuditDeptRef> lw = new LambdaQueryWrapper();
- lw.eq(PmAuditDeptRef::getRefId, pmDemandReqVo.getDemandId());
- lw.eq(PmAuditDeptRef::getRefType, "2");
- List<PmAuditDeptRef> list = pmAuditDeptRefService.list(lw);
- boolean flay = true;
- if (!ObjectUtils.isEmpty(list)) {
- for (PmAuditDeptRef pmAuditDeptRef : list) {
- // 判断 deptLevel 是否还有更高的 且是 待审核的数据
- if (pmAuditDeptRef.getDeptLevel().compareTo(deptLevel) > 0
- && pmAuditDeptRef.getStatus().equals(Integer.parseInt("0"))) {
- flay = false;
- }
- // 更新当前 deptLevel 级别的审核状态
- if (pmAuditDeptRef.getDeptLevel().compareTo(deptLevel) == 0) {
- pmAuditDeptRef.setStatus(1);
- pmAuditDeptRefService.updateById(pmAuditDeptRef);
- }
- }
- }
- if (flay) {
- pmDemandUpdate.setProjectStatus(PmProjectStatus.TASK_WAIT_RELEASE.getCode());
- }
- List<SysFileRef> sysFileRefs = pmDemandReqVo.getSysFileRefs();
- uploadFile(pmDemandReqVo.getDemandId(), SysFileRefEnum.PM_DEMAND_EXAMINE.getType(), sysFileRefs, pmDemandReqVo.getUpdateBy());
- pmDemandUpdate.setUpdateBy(pmDemandReqVo.getUpdateBy());
- pmDemandUpdate.setUpdateTime(DateUtils.getNowDate());
- pmDemandUpdate.setAuditTime(DateUtils.getNowDate());
- return this.updateById(pmDemandUpdate);
- }
- /**
- * 审核采购需求退回
- *
- * @param pmDemandReqVo
- * @return 结果
- */
- @Override
- @Transactional(rollbackFor = Exception.class)
- public boolean reviewReturn(PmDemandReqVo pmDemandReqVo) {
- UpdateWrapper<PmDemand> updateWrapper = new UpdateWrapper<>();
- updateWrapper.lambda().eq(PmDemand::getDemandId, pmDemandReqVo.getDemandId())
- .set(PmDemand::getProjectStatus, PmProjectStatus.DEMAND_AUDIT_RETURN.getCode())
- .set(PmDemand::getAdjustReason, pmDemandReqVo.getRefuseReason())
- .set(PmDemand::getRealDemandCommitTime, null)
- .set(PmDemand::getUpdateBy, pmDemandReqVo.getUpdateBy())
- .set(PmDemand::getUpdateTime, DateUtils.getNowDate())
- .set(PmDemand::getAuditTime, DateUtils.getNowDate());
- LambdaQueryWrapper<PmAuditDeptRef> lw = new LambdaQueryWrapper();
- lw.eq(PmAuditDeptRef::getRefId, pmDemandReqVo.getDemandId());
- lw.eq(PmAuditDeptRef::getRefType, "2");
- pmAuditDeptRefService.remove(lw);
- return this.update(updateWrapper);
- }
- /**
- * 下达任务
- *
- * @param pmDemandReqVo
- * @return 结果
- */
- @Override
- @Transactional(rollbackFor = Exception.class)
- public boolean releaseTask(PmDemandReqVo pmDemandReqVo) {
- PmDemand pmDemand = new PmDemand();
- pmDemand.setDemandId(pmDemandReqVo.getDemandId());
- pmDemand.setProjectStatus(PmProjectStatus.WAIT_SELECT_AGENT.getCode());
- List<SysFileRef> sysFileRefs = pmDemandReqVo.getSysFileRefs();
- uploadFile(pmDemandReqVo.getDemandId(), SysFileRefEnum.PM_TAST_RELEASE.getType(), sysFileRefs, pmDemandReqVo.getUpdateBy());
- pmDemand.setUpdateBy(pmDemandReqVo.getUpdateBy());
- pmDemand.setUpdateTime(DateUtils.getNowDate());
- pmDemand.setAuditTime(DateUtils.getNowDate());
- return this.updateById(pmDemand);
- }
- @Override
- @Transactional(rollbackFor = Exception.class)
- public boolean uploadFile(Long redId, Integer fileType, List<SysFileRef> sysFileRefs, String upateBy) {
- if (!ObjectUtils.isEmpty(sysFileRefs)) {
- //删除老的
- // QueryWrapper<SysFileRef> queryWrapper = new QueryWrapper<>();
- // queryWrapper.lambda().eq(SysFileRef::getRedId, redId)
- // .eq(SysFileRef::getType, fileType);
- // List<SysFileRef> sysFileRefList = sysFileRefService.list(queryWrapper);
- // if (!CollectionUtils.isEmpty(sysFileRefList)) {
- // sysFileRefService.remove(queryWrapper);
- // }
- //添加新的
- for (SysFileRef ref : sysFileRefs) {
- if (ref.getFileId() == null) {
- continue;
- }
- ref.setRedId(redId);
- ref.setType(fileType);
- ref.setCreated(upateBy);
- ref.setCreateTime(new Date());
- ref.setUpdated(upateBy);
- ref.setUpdateTime(ref.getCreateTime());
- sysFileRefService.save(ref);
- }
- return true;
- } else {
- return false;
- }
- }
- @Override
- @Transactional(rollbackFor = Exception.class)
- public boolean insertPmReleaseAnnouncement(PmReleaseAnnouncementReqVo pmReleaseAnnouncementReqVo) throws Exception {
- PmDemand pmDemand = this.getById(pmReleaseAnnouncementReqVo.getDemandId());
- if (ObjectUtils.isEmpty(pmDemand)) {
- throw new Exception("参数错误");
- }
- if (ObjectUtils.isEmpty(pmReleaseAnnouncementReqVo.getSysFileRefs())) {
- throw new Exception("上传附件不能为空");
- }
- PmReleaseAnnouncement pmReleaseAnnouncement = new PmReleaseAnnouncement();
- BeanUtils.copyProperties(pmReleaseAnnouncementReqVo, pmReleaseAnnouncement);
- if (pmReleaseAnnouncementService.saveOrUpdate(pmReleaseAnnouncement)) {
- uploadFile(pmReleaseAnnouncement.getId(), SysFileRefEnum.PM_ANNOUNCEMENT_FILE.getType(), pmReleaseAnnouncementReqVo.getSysFileRefs(), pmReleaseAnnouncementReqVo.getUpdateBy());
- PmDemand pmDemandUpdate = new PmDemand();
- pmDemandUpdate.setDemandId(pmReleaseAnnouncementReqVo.getDemandId());
- pmDemandUpdate.setProjectStatus(PmProjectStatus.WAIT_OPEN_BID.getCode());
- pmDemandUpdate.setUpdateTime(pmReleaseAnnouncementReqVo.getUpdateTime());
- pmDemandUpdate.setUpdateBy(pmReleaseAnnouncementReqVo.getUpdateBy());
- if (this.updateById(pmDemandUpdate)) {
- //发布公告生成后,会默认将该数据同步到公告管理和首页中
- BaseNotice baseNotice = new BaseNotice();
- baseNotice.setName(pmDemand.getProjectName());
- baseNotice.setTitle(pmDemand.getProjectName() + "招标公告");
- LambdaQueryWrapper<BaseNoticeType> lambdaQueryWrapper = new LambdaQueryWrapper<>();
- lambdaQueryWrapper.eq(BaseNoticeType::getName, "招标公告");
- BaseNoticeType baseNoticeType = baseNoticeTypeService.getOne(lambdaQueryWrapper);
- if (baseNoticeType == null) {
- throw new Exception("招标公告 公告类型不存在");
- }
- baseNotice.setDemandId(pmDemand.getDemandId());
- baseNotice.setDeptId(pmDemand.getPurchaseDeptId());
- baseNotice.setIsExcess(pmDemand.getIsExcess());
- baseNotice.setType(baseNoticeType.getId());
- baseNotice.setReleaseTime(pmReleaseAnnouncement.getReleaseTime());
- baseNotice.setCreated(pmReleaseAnnouncementReqVo.getCreateBy());
- baseNotice.setCreateTime(pmReleaseAnnouncementReqVo.getCreateTime());
- baseNotice.setUpdated(pmReleaseAnnouncementReqVo.getUpdateBy());
- baseNotice.setUpdateTime(pmReleaseAnnouncementReqVo.getUpdateTime());
- return this.baseNoticeService.saveOrUpdate(baseNotice);
- } else {
- return false;
- }
- } else {
- return false;
- }
- }
- @Override
- @Transactional(rollbackFor = Exception.class)
- public boolean insertExpertBatch(PmBaseExpertFillReqVo pmBaseExpertFillReqVo) throws Exception {
- PmDemand pmDemand = this.getById(pmBaseExpertFillReqVo.getDemandId());
- if (ObjectUtils.isEmpty(pmDemand)) {
- throw new Exception("参数错误");
- }
- List<BaseExpert> baseExpertList = pmBaseExpertFillReqVo.getBaseExpertList();
- if (ObjectUtils.isEmpty(baseExpertList)) {
- throw new Exception("参数错误");
- }
- Date now = new Date();
- for (BaseExpert baseExpert : baseExpertList) {
- if (NameListType.BLACK.getCode().equals(baseExpert.getStatus())) {
- throw new Exception("该专家(身份证号:" + baseExpert.getIdNumber() + ")属于黑名单");
- } else {
- if (ObjectUtils.isEmpty(baseExpert.getStatus())) {
- baseExpert.setStatus(NameListType.WHITE.getCode());
- }
- }
- if (ObjectUtils.isEmpty(baseExpert.getVarietyPurchase()) || !baseExpert.getVarietyPurchase().contains(pmDemand.getProjectType())) {
- throw new Exception("该专家(身份证号:" + baseExpert.getIdNumber() + ")所属采购品种和项目类型不匹配");
- }
- if (ObjectUtils.isEmpty(baseExpert.getCreated())) {
- baseExpert.setCreated(pmBaseExpertFillReqVo.getCreateBy());
- baseExpert.setCreateTime(now);
- }
- if (ObjectUtils.isEmpty(baseExpert.getUpdated())) {
- baseExpert.setUpdated(pmBaseExpertFillReqVo.getUpdateBy());
- baseExpert.setUpdateTime(now);
- }
- if (baseExpertService.saveOrUpdate(baseExpert)) {
- LambdaQueryWrapper<PmDemandExpertRef> pmDemandExpertRefLambdaQueryWrapper = new LambdaQueryWrapper<>();
- pmDemandExpertRefLambdaQueryWrapper.eq(PmDemandExpertRef::getDemandId, pmDemand.getDemandId())
- .eq(PmDemandExpertRef::getExpertId, baseExpert.getId().longValue())
- .eq(PmDemandExpertRef::getAccessTime, pmBaseExpertFillReqVo.getAccessTime());
- PmDemandExpertRef pmDemandExpertRef = pmDemandExpertRefService.getOne(pmDemandExpertRefLambdaQueryWrapper);
- if (pmDemandExpertRef == null) {
- pmDemandExpertRef = new PmDemandExpertRef();
- pmDemandExpertRef.setCreateBy(pmBaseExpertFillReqVo.getCreateBy());
- pmDemandExpertRef.setCreateTime(now);
- }
- pmDemandExpertRef.setDemandId(pmDemand.getDemandId());
- pmDemandExpertRef.setExpertId(baseExpert.getId().longValue());
- pmDemandExpertRef.setAccessTime(DateUtils.parseDate(pmBaseExpertFillReqVo.getAccessTime()));
- pmDemandExpertRef.setUpdateBy(pmBaseExpertFillReqVo.getCreateBy());
- pmDemandExpertRef.setUpdateTime(pmDemandExpertRef.getCreateTime());
- pmDemandExpertRefService.saveOrUpdate(pmDemandExpertRef);
- //专家单位
- if (StringUtils.isNotNull(baseExpert.getUnitInformation())) {
- List<BaseUnitInformation> baseUnitInformationList = baseExpertMapper.selectByUnitInformation(baseExpert.getUnitInformation());
- if (baseUnitInformationList.size() <= 0) {
- BaseUnitInformation baseUnitInformation = new BaseUnitInformation();
- baseUnitInformation.setUnitName(baseExpert.getUnitInformation());
- baseUnitInformation.setCreated(baseExpert.getExpertName());
- baseUnitInformation.setCreateTime(new Date());
- Integer i = baseExpertMapper.insertBaseUnitInformation(baseUnitInformation);
- }
- }
- }
- }
- PmDemand pmDemandUpdate = new PmDemand();
- pmDemandUpdate.setDemandId(pmDemand.getDemandId());
- pmDemandUpdate.setHasExpert("1");
- this.updateById(pmDemandUpdate);
- return true;
- }
- @Override
- @Transactional(rollbackFor = Exception.class)
- public boolean extractExpertBatch(PmBaseExpertExtractReqVo pmBaseExpertExtractReqVo) throws Exception {
- PmDemand pmDemand = this.getById(pmBaseExpertExtractReqVo.getDemandId());
- if (ObjectUtils.isEmpty(pmDemand)) {
- throw new Exception("参数错误");
- }
- String professional = pmBaseExpertExtractReqVo.getProfessional();
- if (ObjectUtils.isEmpty(professional)) {
- throw new Exception("必须选择专家专业");
- }
- String localArea = pmBaseExpertExtractReqVo.getLocalArea();
- if (ObjectUtils.isEmpty(localArea)) {
- throw new Exception("必须选择地域");
- }
- if (!StringUtils.isNumeric(localArea)) {
- throw new Exception("地域必须传数字代码");
- }
- Integer technicalExpertNumber = pmBaseExpertExtractReqVo.getTechnicalExpertNumber();
- if (technicalExpertNumber == null) {
- technicalExpertNumber = 0;
- }
- Integer economicExpertNumber = pmBaseExpertExtractReqVo.getEconomicExpertNumber();
- if (economicExpertNumber == null) {
- economicExpertNumber = 0;
- }
- Integer legalAffairsExpertNumber = pmBaseExpertExtractReqVo.getLegalAffairsExpertNumber();
- if (legalAffairsExpertNumber == null) {
- legalAffairsExpertNumber = 0;
- }
- Integer spareExpertNumber = pmBaseExpertExtractReqVo.getSpareExpertNumber();
- if (spareExpertNumber == null) {
- spareExpertNumber = 0;
- }
- if (technicalExpertNumber + economicExpertNumber + legalAffairsExpertNumber + spareExpertNumber == 0) {
- throw new Exception("必须至少填写一个数量");
- }
- String needAvoidUnit = pmBaseExpertExtractReqVo.getNeedAvoidUnit();
- List<String> needAvoidUnitList = null;
- if (!ObjectUtils.isEmpty(needAvoidUnit)) {
- String[] arr = needAvoidUnit.split(",");
- needAvoidUnitList = Arrays.asList(arr);
- }
- List<String> sysRegionCodeList = new ArrayList<>();
- if (!ObjectUtils.isEmpty(localArea)) {
- sysRegionCodeList.add(localArea);
- //找到该地域code对应的子列表
- List<SysRegionVO> sysRegionVOList = iSysRegionService.findChildDivisions(localArea);
- if (!ObjectUtils.isEmpty(sysRegionVOList)) {
- for (SysRegionVO vo : sysRegionVOList) {
- sysRegionCodeList.add(vo.getCode());
- }
- }
- }
- //从专家库中查询符合项目类型的以及是白名单的全部列表
- LambdaQueryWrapper<BaseExpert> lw = new LambdaQueryWrapper<>();
- lw.eq(BaseExpert::getVarietyPurchase, pmDemand.getProjectType())
- .eq(BaseExpert::getStatus, NameListType.WHITE.getCode())
- .notIn(!ObjectUtils.isEmpty(needAvoidUnitList), BaseExpert::getUnitInformation, needAvoidUnitList)
- .in(!ObjectUtils.isEmpty(sysRegionCodeList), BaseExpert::getLocalArea, sysRegionCodeList); //地域
- List<BaseExpert> baseExpertList = baseExpertService.list(lw);
- if (ObjectUtils.isEmpty(baseExpertList)) {
- throw new Exception("没抽取到符合条件的专家");
- }
- //从列表中挑出来各个类型的子列表
- List<BaseExpert> technicalExpertList = new ArrayList<>();
- List<BaseExpert> economicExpertList = new ArrayList<>();
- List<BaseExpert> legalAffairsExpertList = new ArrayList<>();
- List<BaseExpert> spareExpertList = new ArrayList<>();
- String[] arr = professional.split(",");
- List<String> professionalList = Arrays.asList(arr);
- for (BaseExpert baseExpert : baseExpertList) {
- //专业类型判断
- String majorType = baseExpert.getMajorType();
- if (!ObjectUtils.isEmpty(majorType)) {
- String[] arr2 = majorType.split(",");
- List<String> majorTypeList = Arrays.asList(arr2);
- if (!hasIntersection(professionalList, majorTypeList)) { //不符合专业类型
- continue;
- }
- }
- //备用专家
- if (spareExpertNumber > 0) { //都加进去
- spareExpertList.add(baseExpert);
- }
- if (technicalExpertNumber > 0) {
- if (baseExpert.getExpertType().contains(ExpertType.TECHNICAL_EXPERT.getCode())) {
- technicalExpertList.add(baseExpert);
- continue;
- }
- }
- if (economicExpertNumber > 0) {
- if (baseExpert.getExpertType().contains(ExpertType.ECONOMIC_EXPERT.getCode())) {
- economicExpertList.add(baseExpert);
- continue;
- }
- }
- if (legalAffairsExpertNumber > 0) {
- if (baseExpert.getExpertType().contains(ExpertType.LEGALAFFAIRS_EXPERT.getCode())) {
- legalAffairsExpertList.add(baseExpert);
- continue;
- }
- }
- }
- //从子列表中随机抽取符合数据量的
- List<BaseExpert> alltExpertList = new ArrayList<>();
- if(technicalExpertNumber > 0 && technicalExpertList.size() < technicalExpertNumber){
- throw new Exception("抽取到符合条件的技术专家数量不够");
- }
- if (!ObjectUtils.isEmpty(technicalExpertList)) {
- alltExpertList.addAll(RandomUtil.getRandomList(technicalExpertList, technicalExpertNumber));
- }
- if(economicExpertNumber > 0 && economicExpertList.size() < economicExpertNumber){
- throw new Exception("抽取到符合条件的经济专家数量不够");
- }
- if (!ObjectUtils.isEmpty(economicExpertList)) {
- alltExpertList.addAll(RandomUtil.getRandomList(economicExpertList, economicExpertNumber));
- }
- if(legalAffairsExpertNumber > 0 && legalAffairsExpertList.size() < legalAffairsExpertNumber){
- throw new Exception("抽取到符合条件的法务专家数量不够");
- }
- if (!ObjectUtils.isEmpty(legalAffairsExpertList)) {
- alltExpertList.addAll(RandomUtil.getRandomList(legalAffairsExpertList, legalAffairsExpertNumber));
- }
- List<BaseExpert> spareExpertListNew = new ArrayList<>();
- if (!ObjectUtils.isEmpty(spareExpertList)) {
- //获取全部IDlist
- List<Integer> allExpertIdList = new ArrayList<>();
- if (!ObjectUtils.isEmpty(alltExpertList)) {
- for (BaseExpert baseExpert : alltExpertList) {
- allExpertIdList.add(baseExpert.getId());
- }
- }
- //遍历全部IDlist
- if (!ObjectUtils.isEmpty(allExpertIdList)) { //去重
- for (BaseExpert baseExpert : spareExpertList) {
- if (!allExpertIdList.contains(baseExpert.getId())) {
- spareExpertListNew.add(baseExpert);
- }
- }
- } else {
- spareExpertListNew = spareExpertList;
- }
- if (!ObjectUtils.isEmpty(spareExpertListNew)) {
- alltExpertList.addAll(RandomUtil.getRandomList(spareExpertListNew, spareExpertNumber));
- }
- }
- if(spareExpertNumber > 0 && spareExpertListNew.size() < spareExpertNumber){
- throw new Exception("抽取到符合条件的备用专家数量不够");
- }
- if (ObjectUtils.isEmpty(alltExpertList)) {
- throw new Exception("没抽取到符合条件的专家");
- } else {
- List<PmDemandExpertRef> pmDemandExpertRefList = new ArrayList<>();
- for (BaseExpert baseExpert : alltExpertList) {
- LambdaQueryWrapper<PmDemandExpertRef> baseExpertLambdaQueryWrapper = new LambdaQueryWrapper<>();
- baseExpertLambdaQueryWrapper.eq(PmDemandExpertRef::getExpertId, baseExpert.getId().longValue())
- .eq(PmDemandExpertRef::getDemandId, pmDemand.getDemandId())
- .eq(PmDemandExpertRef::getAccessTime, pmBaseExpertExtractReqVo.getAccessTime());
- PmDemandExpertRef pmDemandExpertRef = pmDemandExpertRefService.getOne(baseExpertLambdaQueryWrapper);
- if (pmDemandExpertRef == null) {
- pmDemandExpertRef = new PmDemandExpertRef();
- pmDemandExpertRef.setCreateBy(pmBaseExpertExtractReqVo.getCreateBy());
- pmDemandExpertRef.setCreateTime(new Date());
- }
- pmDemandExpertRef.setDemandId(pmDemand.getDemandId());
- pmDemandExpertRef.setExpertId(baseExpert.getId().longValue());
- pmDemandExpertRef.setAccessTime(DateUtils.parseDate(pmBaseExpertExtractReqVo.getAccessTime()));
- pmDemandExpertRef.setUpdateBy(pmBaseExpertExtractReqVo.getCreateBy());
- pmDemandExpertRef.setUpdateTime(pmDemandExpertRef.getCreateTime());
- pmDemandExpertRefList.add(pmDemandExpertRef);
- }
- PmDemand pmDemandUpdate = new PmDemand();
- pmDemandUpdate.setDemandId(pmDemand.getDemandId());
- pmDemandUpdate.setHasExpert("1");
- this.updateById(pmDemandUpdate);
- return pmDemandExpertRefService.saveOrUpdateBatch(pmDemandExpertRefList);
- }
- }
- //二个列表是否有交集
- private boolean hasIntersection(List<String> professionalList, List<String> majorTypeList) {
- for (String professiona : professionalList) {
- for (String majorType : majorTypeList) {
- if (professiona.equals(majorType)) {
- return true;
- }
- }
- }
- return false;
- }
- @Override
- @Transactional(rollbackFor = Exception.class)
- public boolean insertBidOpeningBatch(PmBidOpeningFillReqVo pmBidOpeningFillReqVo) throws Exception {
- PmDemand pmDemand = this.getById(pmBidOpeningFillReqVo.getDemandId());
- if (ObjectUtils.isEmpty(pmDemand)) {
- throw new Exception("参数错误");
- }
- //从发布公告里获取开标时间
- LambdaQueryWrapper<PmReleaseAnnouncement> lw = new LambdaQueryWrapper<>();
- lw.eq(PmReleaseAnnouncement::getDemandId, pmDemand.getDemandId()).orderByDesc(PmReleaseAnnouncement::getReleaseTime)
- .last(" limit 1 ");
- PmReleaseAnnouncement pmReleaseAnnouncement = this.pmReleaseAnnouncementService.getOne(lw);
- if (pmReleaseAnnouncement == null) {
- throw new Exception("发布公告不存在");
- }
- Date tenderOpenTime = pmReleaseAnnouncement.getTenderOpenTime();
- Date now = new Date();
- List<PmBidOpening> pmBidOpeningList = pmBidOpeningFillReqVo.getPmBidOpeningList();
- for (PmBidOpening pmBidOpening : pmBidOpeningList) {
- if (ObjectUtils.isEmpty(pmBidOpening.getBidderName())) {
- throw new Exception("投标人名称不能为空");
- }
- if (ObjectUtils.isEmpty(pmBidOpening.getScore())) {
- throw new Exception("分数不能为空");
- }
- pmBidOpening.setOpenBidTime(tenderOpenTime);
- pmBidOpening.setDemandId(pmBidOpeningFillReqVo.getDemandId());
- pmBidOpening.setCreateBy(pmBidOpeningFillReqVo.getCreateBy());
- pmBidOpening.setCreateTime(now);
- pmBidOpening.setUpdateBy(pmBidOpeningFillReqVo.getUpdateBy());
- pmBidOpening.setUpdateTime(now);
- }
- if (pmBidOpeningService.saveOrUpdateBatch(pmBidOpeningList)) {
- PmDemand pmDemandUpdate = new PmDemand();
- pmDemandUpdate.setDemandId(pmDemand.getDemandId());
- pmDemandUpdate.setProjectStatus(PmProjectStatus.WAIT_BID_ANNOUNCEMENT.getCode());
- pmDemandUpdate.setUpdateTime(now);
- pmDemandUpdate.setUpdateBy(pmBidOpeningFillReqVo.getUpdateBy());
- return this.updateById(pmDemandUpdate);
- } else {
- return false;
- }
- }
- /**
- * 填写中标
- *
- * @param pmBidWinningReqVo
- * @return
- * @throws Exception
- */
- @Override
- @Transactional(rollbackFor = Exception.class)
- public boolean insertPmBidWinning(PmBidWinningReqVo pmBidWinningReqVo) throws Exception {
- List<Long> pmBidOpeningIdList = pmBidWinningReqVo.getPmBidOpeningIdList();
- if (ObjectUtils.isEmpty(pmBidWinningReqVo.getBidWinningAmount())) {
- throw new Exception("中标金额不能为空");
- }
- if (ObjectUtils.isEmpty(pmBidOpeningIdList)) {
- throw new Exception("中标单位信息列表不能为空");
- }
- if (ObjectUtils.isEmpty(pmBidWinningReqVo.getSysFileRefs())) {
- throw new Exception("上传附件不能为空");
- }
- PmBidWinning pmBidWinning = new PmBidWinning();
- BeanUtils.copyProperties(pmBidWinningReqVo, pmBidWinning);
- //修改老的中标信息状态
- if (ObjectUtils.isEmpty(pmBidWinningReqVo.getId())) { //属于新增
- LambdaQueryWrapper<PmBidWinning> pmBidWinningLambdaQueryWrapper = new LambdaQueryWrapper<>();
- pmBidWinningLambdaQueryWrapper.eq(PmBidWinning::getDemandId, pmBidWinningReqVo.getDemandId())
- .eq(PmBidWinning::getStatus, BidWinningStatus.NORMAL.getCode());
- List<PmBidWinning> pmBidWinninglist = pmBidWinningService.list(pmBidWinningLambdaQueryWrapper);
- if (!ObjectUtils.isEmpty(pmBidWinninglist)) {
- for (PmBidWinning item : pmBidWinninglist) {
- UpdateWrapper<PmBidWinning> updateWrapper1 = new UpdateWrapper<>();
- updateWrapper1.lambda().set(PmBidWinning::getStatus, BidWinningStatus.BE_REPLACED.getCode())
- .eq(PmBidWinning::getId, item.getId());
- pmBidWinningService.update(updateWrapper1);
- UpdateWrapper<PmBidWinningOpeningRef> updateWrapper2 = new UpdateWrapper<>();
- updateWrapper2.lambda().set(PmBidWinningOpeningRef::getStatus, BidWinningStatus.BE_REPLACED.getCode())
- .eq(PmBidWinningOpeningRef::getWinningId, item.getId())
- .eq(PmBidWinningOpeningRef::getStatus, BidWinningStatus.NORMAL.getCode());
- pmBidWinningOpeningRefService.update(updateWrapper2);
- }
- }
- }
- if (pmBidWinningService.saveOrUpdate(pmBidWinning)) {
- List<PmBidWinningOpeningRef> pmBidWinningOpeningRefList = new ArrayList<>();
- for (Long pmBidOpeningId : pmBidOpeningIdList) {
- LambdaQueryWrapper<PmBidWinningOpeningRef> pmBidWinningOpeningRefLambdaQueryWrapper = new LambdaQueryWrapper<>();
- pmBidWinningOpeningRefLambdaQueryWrapper.eq(PmBidWinningOpeningRef::getOpeningId, pmBidOpeningId)
- .eq(PmBidWinningOpeningRef::getWinningId, pmBidWinning.getId());
- PmBidWinningOpeningRef pmBidWinningOpeningRef = pmBidWinningOpeningRefService.getOne(pmBidWinningOpeningRefLambdaQueryWrapper);
- if (pmBidWinningOpeningRef == null) {
- pmBidWinningOpeningRef = new PmBidWinningOpeningRef();
- pmBidWinningOpeningRef.setCreateBy(pmBidWinningReqVo.getCreateBy());
- pmBidWinningOpeningRef.setCreateTime(pmBidWinningReqVo.getCreateTime());
- }
- pmBidWinningOpeningRef.setOpeningId(pmBidOpeningId);
- pmBidWinningOpeningRef.setWinningId(pmBidWinning.getId());
- pmBidWinningOpeningRef.setUpdateBy(pmBidWinningReqVo.getUpdateBy());
- pmBidWinningOpeningRef.setUpdateTime(pmBidWinningReqVo.getUpdateTime());
- pmBidWinningOpeningRefList.add(pmBidWinningOpeningRef);
- }
- if (pmBidWinningOpeningRefService.saveOrUpdateBatch(pmBidWinningOpeningRefList)) {
- uploadFile(pmBidWinning.getId(), SysFileRefEnum.PM_BID_WINNING_FILE.getType(), pmBidWinningReqVo.getSysFileRefs(), pmBidWinningReqVo.getUpdateBy());
- //发布公告生成后,会默认将该数据同步到公告管理和首页中
- PmDemand pmDemand = this.getById(pmBidWinningReqVo.getDemandId());
- BaseNotice baseNotice = new BaseNotice();
- baseNotice.setName(pmDemand.getProjectName());
- baseNotice.setTitle(pmDemand.getProjectName() + "中标公告");
- LambdaQueryWrapper<BaseNoticeType> lambdaQueryWrapper = new LambdaQueryWrapper<>();
- lambdaQueryWrapper.eq(BaseNoticeType::getName, "中标公告");
- BaseNoticeType baseNoticeType = baseNoticeTypeService.getOne(lambdaQueryWrapper);
- if (baseNoticeType == null) {
- throw new Exception("中标公告 公告类型不存在");
- }
- baseNotice.setDemandId(pmDemand.getDemandId());
- baseNotice.setDeptId(pmDemand.getPurchaseDeptId());
- baseNotice.setIsExcess(pmDemand.getIsExcess());
- baseNotice.setType(baseNoticeType.getId());
- baseNotice.setReleaseTime(pmBidWinningReqVo.getBidAnnouncementTime());
- baseNotice.setCreated(pmBidWinningReqVo.getCreateBy());
- baseNotice.setCreateTime(pmBidWinningReqVo.getCreateTime());
- baseNotice.setUpdated(pmBidWinningReqVo.getUpdateBy());
- baseNotice.setUpdateTime(pmBidWinningReqVo.getUpdateTime());
- this.baseNoticeService.saveOrUpdate(baseNotice);
- PmDemand pmDemandUpdate = new PmDemand();
- pmDemandUpdate.setDemandId(pmBidWinningReqVo.getDemandId());
- pmDemandUpdate.setProjectStatus(PmProjectStatus.BIDDING_PUBLICITY.getCode());
- pmDemandUpdate.setUpdateTime(pmBidWinningReqVo.getUpdateTime());
- pmDemandUpdate.setUpdateBy(pmBidWinningReqVo.getUpdateBy());
- return this.updateById(pmDemandUpdate);
- } else {
- return false;
- }
- } else {
- return false;
- }
- }
- @Override
- @Transactional(rollbackFor = Exception.class)
- public boolean updatePmBidWinning(PmBidWinningReqVo pmBidWinningReqVo) throws Exception {
- List<Long> pmBidOpeningIdList = pmBidWinningReqVo.getPmBidOpeningIdList();
- if (ObjectUtils.isEmpty(pmBidOpeningIdList)) {
- throw new Exception("中标单位信息列表不能为空");
- }
- if (ObjectUtils.isEmpty(pmBidWinningReqVo.getBidWinningAmount())) {
- throw new Exception("中标金额不能为空");
- }
- if (ObjectUtils.isEmpty(pmBidWinningReqVo.getSysFileRefs())) {
- throw new Exception("上传附件不能为空");
- }
- LambdaQueryWrapper<PmBidWinning> lw = new LambdaQueryWrapper<>();
- lw.eq(PmBidWinning::getDemandId, pmBidWinningReqVo.getDemandId()).eq(PmBidWinning::getStatus, BidWinningStatus.NORMAL.getCode());
- List<PmBidWinning> pmBidWinninglist = pmBidWinningService.list(lw);
- if (ObjectUtils.isEmpty(pmBidWinninglist)) {
- throw new Exception("原中标信息不存在");
- }
- //修改老的状态
- for (PmBidWinning item : pmBidWinninglist) {
- UpdateWrapper<PmBidWinning> updateWrapper1 = new UpdateWrapper<>();
- updateWrapper1.lambda().set(PmBidWinning::getStatus, BidWinningStatus.BE_REPLACED.getCode())
- .eq(PmBidWinning::getId, item.getId());
- pmBidWinningService.update(updateWrapper1);
- UpdateWrapper<PmBidWinningOpeningRef> updateWrapper2 = new UpdateWrapper<>();
- updateWrapper2.lambda().set(PmBidWinningOpeningRef::getStatus, BidWinningStatus.BE_REPLACED.getCode())
- .eq(PmBidWinningOpeningRef::getWinningId, item.getId())
- .eq(PmBidWinningOpeningRef::getStatus, BidWinningStatus.NORMAL.getCode());
- pmBidWinningOpeningRefService.update(updateWrapper2);
- }
- //新增
- PmBidWinning pmBidWinning = new PmBidWinning();
- BeanUtils.copyProperties(pmBidWinninglist.get(0), pmBidWinning);
- pmBidWinning.setId(null);
- pmBidWinning.setBidWinningAmount(pmBidWinningReqVo.getBidWinningAmount());
- pmBidWinning.setStatus(BidWinningStatus.NORMAL.getCode());
- pmBidWinning.setUpdateBy(pmBidWinningReqVo.getUpdateBy());
- pmBidWinning.setUpdateTime(pmBidWinningReqVo.getUpdateTime());
- if (pmBidWinningService.save(pmBidWinning)) {
- List<PmBidWinningOpeningRef> pmBidWinningOpeningRefList = new ArrayList<>();
- for (Long pmBidOpeningId : pmBidOpeningIdList) {
- PmBidWinningOpeningRef pmBidWinningOpeningRef = new PmBidWinningOpeningRef();
- pmBidWinningOpeningRef.setOpeningId(pmBidOpeningId);
- pmBidWinningOpeningRef.setWinningId(pmBidWinning.getId());
- pmBidWinningOpeningRef.setStatus(BidWinningStatus.NORMAL.getCode());
- pmBidWinningOpeningRef.setCreateBy(pmBidWinningReqVo.getCreateBy());
- pmBidWinningOpeningRef.setCreateTime(pmBidWinningReqVo.getCreateTime());
- pmBidWinningOpeningRef.setUpdateBy(pmBidWinningReqVo.getUpdateBy());
- pmBidWinningOpeningRef.setUpdateTime(pmBidWinningReqVo.getUpdateTime());
- pmBidWinningOpeningRefList.add(pmBidWinningOpeningRef);
- }
- LambdaQueryWrapper<SysFileRef> sysFileRefLambdaQueryWrapper = new LambdaQueryWrapper<>();
- sysFileRefLambdaQueryWrapper.eq(SysFileRef::getType, SysFileRefEnum.PM_BID_WINNING_FILE.getType())
- .eq(SysFileRef::getRedId, pmBidWinninglist.get(0));
- List<SysFileRef> sysFileRefs = sysFileRefService.list(sysFileRefLambdaQueryWrapper);
- uploadFile(pmBidWinning.getId(), SysFileRefEnum.PM_BID_WINNING_FILE.getType(), sysFileRefs, pmBidWinningReqVo.getUpdateBy());
- return pmBidWinningOpeningRefService.saveBatch(pmBidWinningOpeningRefList);
- } else {
- return false;
- }
- }
- /**
- * 流标
- *
- * @param pmBidFailureReqVo
- * @return
- * @throws Exception
- */
- @Override
- @Transactional(rollbackFor = Exception.class)
- public boolean insertPmBidFailure(PmBidFailureReqVo pmBidFailureReqVo) throws Exception {
- PmBidFailure pmBidFailure = new PmBidFailure();
- BeanUtils.copyProperties(pmBidFailureReqVo, pmBidFailure);
- if (pmBidFailureService.saveOrUpdate(pmBidFailure)) {
- //把中标信息修改状态
- LambdaQueryWrapper<PmBidWinning> lw = new LambdaQueryWrapper<>();
- lw.eq(PmBidWinning::getDemandId, pmBidFailureReqVo.getDemandId()).eq(PmBidWinning::getStatus, BidWinningStatus.NORMAL.getCode());
- List<PmBidWinning> pmBidWinninglist = pmBidWinningService.list(lw);
- if (!ObjectUtils.isEmpty(pmBidWinninglist)) {
- for (PmBidWinning item : pmBidWinninglist) {
- UpdateWrapper<PmBidWinning> updateWrapper1 = new UpdateWrapper<>();
- updateWrapper1.lambda().set(PmBidWinning::getStatus, BidWinningStatus.BE_BID_FAILURE.getCode())
- .eq(PmBidWinning::getId, item.getId());
- pmBidWinningService.update(updateWrapper1);
- UpdateWrapper<PmBidWinningOpeningRef> updateWrapper2 = new UpdateWrapper<>();
- updateWrapper2.lambda().set(PmBidWinningOpeningRef::getStatus, BidWinningStatus.BE_BID_FAILURE.getCode())
- .eq(PmBidWinningOpeningRef::getWinningId, item.getId())
- .eq(PmBidWinningOpeningRef::getStatus, BidWinningStatus.NORMAL.getCode());
- pmBidWinningOpeningRefService.update(updateWrapper2);
- }
- }
- uploadFile(pmBidFailure.getId(), SysFileRefEnum.PM_BID_FAILURE_FILE.getType(), pmBidFailureReqVo.getSysFileRefs(), pmBidFailureReqVo.getUpdateBy());
- //发布公告生成后,会默认将该数据同步到公告管理和首页中
- PmDemand pmDemand = this.getById(pmBidFailureReqVo.getDemandId());
- BaseNotice baseNotice = new BaseNotice();
- baseNotice.setName(pmDemand.getProjectName());
- baseNotice.setTitle(pmDemand.getProjectName() + "流标公告");
- LambdaQueryWrapper<BaseNoticeType> lambdaQueryWrapper = new LambdaQueryWrapper<>();
- lambdaQueryWrapper.eq(BaseNoticeType::getName, "流标公告");
- BaseNoticeType baseNoticeType = baseNoticeTypeService.getOne(lambdaQueryWrapper);
- if (baseNoticeType == null) {
- throw new Exception("流标公告 公告类型不存在");
- }
- baseNotice.setDemandId(pmDemand.getDemandId());
- baseNotice.setDeptId(pmDemand.getPurchaseDeptId());
- baseNotice.setIsExcess(pmDemand.getIsExcess());
- baseNotice.setType(baseNoticeType.getId());
- baseNotice.setReleaseTime(pmBidFailureReqVo.getBidFailureTime());
- baseNotice.setCreated(pmBidFailureReqVo.getCreateBy());
- baseNotice.setCreateTime(pmBidFailureReqVo.getCreateTime());
- baseNotice.setUpdated(pmBidFailureReqVo.getUpdateBy());
- baseNotice.setUpdateTime(pmBidFailureReqVo.getUpdateTime());
- this.baseNoticeService.saveOrUpdate(baseNotice);
- PmDemand pmDemandUpdate = new PmDemand();
- pmDemandUpdate.setDemandId(pmBidFailureReqVo.getDemandId());
- pmDemandUpdate.setProjectStatus(PmProjectStatus.WAIT_ANNOUNCEMENT.getCode());
- pmDemandUpdate.setHasExpert("0");
- pmDemandUpdate.setUpdateTime(pmBidFailureReqVo.getUpdateTime());
- pmDemandUpdate.setUpdateBy(pmBidFailureReqVo.getUpdateBy());
- return this.updateById(pmDemandUpdate);
- } else {
- return false;
- }
- }
- @Override
- @Transactional(rollbackFor = Exception.class)
- public boolean insertContractInfo(PmContractInfoReqVo pmContractInfoReqVo) throws Exception {
- Long demandId = pmContractInfoReqVo.getDemandId();
- if (ObjectUtils.isEmpty(demandId)) {
- throw new Exception("采购需求ID不能为空");
- }
- PmDemand pmDemand = this.getById(demandId);
- if (ObjectUtils.isEmpty(pmDemand)) {
- throw new Exception("采购需求ID错误");
- }
- List<SysFileRef> sysFileRefs = pmContractInfoReqVo.getSysFileRefs();
- if (ObjectUtils.isEmpty(sysFileRefs)) {
- throw new Exception("上传附件不能为空");
- }
- LambdaQueryWrapper<PmContractInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
- lambdaQueryWrapper.eq(PmContractInfo::getDemandId, demandId);
- PmContractInfo pmContractInfo = pmContractInfoService.getOne(lambdaQueryWrapper);
- if (pmContractInfo != null) {
- pmContractInfoReqVo.setId(pmContractInfo.getId());
- BeanUtils.copyProperties(pmContractInfoReqVo, pmContractInfo);
- pmContractInfo.setUpdateTime(pmContractInfoReqVo.getUpdateTime());
- pmContractInfo.setUpdateBy(pmContractInfoReqVo.getUpdateBy());
- } else {
- pmContractInfo = new PmContractInfo();
- BeanUtils.copyProperties(pmContractInfoReqVo, pmContractInfo);
- pmContractInfo.setCreateBy(pmContractInfoReqVo.getCreateBy());
- pmContractInfo.setCreateTime(pmContractInfoReqVo.getCreateTime());
- pmContractInfo.setUpdateTime(pmContractInfoReqVo.getUpdateTime());
- pmContractInfo.setUpdateBy(pmContractInfoReqVo.getUpdateBy());
- }
- if (pmContractInfoService.saveOrUpdate(pmContractInfo)) {
- this.uploadFile(pmContractInfo.getId(), SysFileRefEnum.PM_CONTRACT_INFO.getType(), sysFileRefs, pmContractInfoReqVo.getUpdateBy());
- PmDemand pmDemandUpdate = new PmDemand();
- pmDemandUpdate.setDemandId(demandId);
- pmDemandUpdate.setProjectStatus(PmProjectStatus.UNDER_CONSTRUCTION.getCode());
- pmDemandUpdate.setUpdateTime(pmContractInfoReqVo.getUpdateTime());
- pmDemandUpdate.setUpdateBy(pmContractInfoReqVo.getUpdateBy());
- return this.updateById(pmDemandUpdate);
- } else {
- return false;
- }
- }
- @Override
- @Transactional(rollbackFor = Exception.class)
- public boolean insertProjectConstruction(PmProjectConstructionReqVo pmProjectConstructionReqVo) throws Exception {
- Long demandId = pmProjectConstructionReqVo.getDemandId();
- if (ObjectUtils.isEmpty(demandId)) {
- throw new Exception("采购需求ID不能为空");
- }
- PmDemand pmDemand = this.getById(demandId);
- if (ObjectUtils.isEmpty(pmDemand)) {
- throw new Exception("采购需求ID错误");
- }
- List<SysFileRef> sysFileRefs = pmProjectConstructionReqVo.getSysFileRefs();
- if (ObjectUtils.isEmpty(sysFileRefs)) {
- throw new Exception("上传附件不能为空");
- }
- LambdaQueryWrapper<PmProjectConstruction> lambdaQueryWrapper = new LambdaQueryWrapper<>();
- lambdaQueryWrapper.eq(PmProjectConstruction::getDemandId, demandId);
- PmProjectConstruction pmProjectConstruction = pmProjectConstructionService.getOne(lambdaQueryWrapper);
- if (pmProjectConstruction != null) {
- pmProjectConstructionReqVo.setId(pmProjectConstruction.getId());
- BeanUtils.copyProperties(pmProjectConstructionReqVo, pmProjectConstruction);
- pmProjectConstruction.setUpdateBy(pmProjectConstructionReqVo.getUpdateBy());
- pmProjectConstruction.setUpdateTime(pmProjectConstructionReqVo.getUpdateTime());
- } else {
- pmProjectConstruction = new PmProjectConstruction();
- BeanUtils.copyProperties(pmProjectConstructionReqVo, pmProjectConstruction);
- pmProjectConstruction.setCreateBy(pmProjectConstructionReqVo.getCreateBy());
- pmProjectConstruction.setCreateTime(pmProjectConstructionReqVo.getCreateTime());
- pmProjectConstruction.setUpdateBy(pmProjectConstructionReqVo.getUpdateBy());
- pmProjectConstruction.setUpdateTime(pmProjectConstructionReqVo.getUpdateTime());
- }
- if (pmProjectConstructionService.saveOrUpdate(pmProjectConstruction)) {
- this.uploadFile(pmProjectConstruction.getId(), SysFileRefEnum.PM_PROJECT_CONSTRUCTION.getType(), sysFileRefs, pmProjectConstructionReqVo.getUpdateBy());
- PmDemand pmDemandUpdate = new PmDemand();
- pmDemandUpdate.setDemandId(demandId);
- pmDemandUpdate.setProjectStatus(PmProjectStatus.COMPLETION_CONSTRUCTION.getCode());
- pmDemandUpdate.setRealDeliverTime(pmProjectConstructionReqVo.getUpdateTime());
- pmDemandUpdate.setUpdateTime(pmProjectConstructionReqVo.getUpdateTime());
- pmDemandUpdate.setUpdateBy(pmProjectConstructionReqVo.getUpdateBy());
- return this.updateById(pmDemandUpdate);
- } else {
- return false;
- }
- }
- /**
- * 更新需求预警状态
- *
- * @param demnadId
- * @return
- */
- @Override
- @Transactional(rollbackFor = Exception.class)
- public void updateDemandWarnStatus(Long demnadId) {
- PmDemand pmDemand = this.getById(demnadId);
- List<SysDictData> data = iSysDictTypeService.selectDictDataByType("alert_time_setting");
- int setting1 = Integer.parseInt(data.stream().filter(item -> item.getDictLabel().equals("计划提报时间")).collect(Collectors.toList()).get(0).getDictValue());
- log.info("******** setting1 == " + setting1);
- //需求提报时间:根据数据阈值中设置的提报时间进行判断,进行预警
- int diff1 = DateUtils.differentDaysByMillisecond(pmDemand.getPlanDemandSubTime(), DateUtils.parseDate(DateUtils.getDate()));
- if (ObjectUtils.isEmpty(pmDemand.getRealDemandCommitTime()) && diff1 >= setting1) {
- PmDemand pmDemandUpdate = new PmDemand();
- pmDemandUpdate.setDemandId(demnadId);
- pmDemandUpdate.setWarnStatus(WarnStatus.DEMAND_COMMT_WARNING.getCode());
- this.updateById(pmDemandUpdate);
- }
- }
- /**
- * 通过需求ID列表 查询采购执行列表 sunhh
- *
- * @param demandIdList
- * @return
- */
- @Override
- public List<PmDemand> selectByDemandIdList(List<Integer> demandIdList) {
- return this.baseMapper.selectByDemandIdList(demandIdList);
- }
- /**
- * 专家库--查询抽取专家列表 非必传条件:专家名称,开始结束时间 sunhh
- *
- * @param baseExpertVo
- * @return
- */
- @Override
- public List<PmDemand> selectExtractionExpert(BaseExpertVo baseExpertVo) {
- return this.baseMapper.selectExtractionExpert(baseExpertVo);
- }
- @Override
- public List<PmDemandResVo> demandWaitCommit() {
- return getListByStatus(PmProjectStatus.DEMAND_WAIT_COMMIT.getCode());
- }
- @Override
- public List<PmDemandResVo> contractWaitFilled() {
- return getListByStatus(PmProjectStatus.CONTRACT_WAIT_FILL.getCode());
- }
- @Override
- public List<PmDemandResVo> projectWaitFinish() {
- return getListByStatus(PmProjectStatus.UNDER_CONSTRUCTION.getCode());
- }
- @Override
- public List<PmDemandResVo> demandWaitExamine() {
- return getListByStatus(PmProjectStatus.DEMAND_WAIT_AUDIT.getCode());
- }
- @Override
- public List<PmDemandResVo> taskWaitRelease() {
- return getListByStatus(PmProjectStatus.TASK_WAIT_RELEASE.getCode());
- }
- @Override
- public List<PmDemandResVo> waitSelectAgent() {
- return getListByStatus(PmProjectStatus.WAIT_SELECT_AGENT.getCode());
- }
- @Override
- public List<PmDemandResVo> waitUpBidFile() {
- return getListByStatus(PmProjectStatus.WAIT_UPLOAD_BID_FILE.getCode());
- }
- @Override
- public List<PmDemandResVo> waitAnnouncement() {
- return getListByStatus(PmProjectStatus.WAIT_ANNOUNCEMENT.getCode());
- }
- @Override
- public List<PmDemandResVo> waitOpenBid() {
- return getListByStatus(PmProjectStatus.WAIT_OPEN_BID.getCode());
- }
- @Override
- public List<PmDemandResVo> waitBidAnnouncement() {
- return getListByStatus(PmProjectStatus.WAIT_BID_ANNOUNCEMENT.getCode());
- }
- @Override
- public List<PmDemandResVo> biddingPublicity() {
- return getListByStatus(PmProjectStatus.BIDDING_PUBLICITY.getCode());
- }
- @Override
- public AjaxResult procurementOfficeWillManipulateTotal() {
- List<HomeToDoQueryResVo> homeRes = new ArrayList<>();
- // 待选取代理, 待上传招标文件, 待发布公告, 待开标, 待发布中标公告, 中标公示中
- List<PmDemandResVo> demandRes = new ArrayList<>();
- demandRes.addAll(getListByStatus(PmProjectStatus.WAIT_SELECT_AGENT.getCode()));
- demandRes.addAll(getListByStatus(PmProjectStatus.WAIT_UPLOAD_BID_FILE.getCode()));
- demandRes.addAll(getListByStatus(PmProjectStatus.WAIT_ANNOUNCEMENT.getCode()));
- demandRes.addAll(getListByStatus(PmProjectStatus.WAIT_OPEN_BID.getCode()));
- demandRes.addAll(getListByStatus(PmProjectStatus.WAIT_BID_ANNOUNCEMENT.getCode()));
- demandRes.addAll(getListByStatus(PmProjectStatus.BIDDING_PUBLICITY.getCode()));
- //计划数据--发函催告
- List<PlanQuarterResponseVo> planRes = planYearsService.willSendLetter();
- //转为首页table展示数据
- if (!ObjectUtils.isEmpty(demandRes) && demandRes.size() > 0) {
- for (PmDemandResVo demandResVo : demandRes) {
- HomeToDoQueryResVo home = new HomeToDoQueryResVo();
- home.setEvaluation(BigDecimal.valueOf(demandResVo.getEvaluation()));
- BeanUtils.copyProperties(demandResVo, home);
- homeRes.add(home);
- }
- }
- if (!ObjectUtils.isEmpty(planRes) && planRes.size() > 0) {
- for (PlanQuarterResponseVo planVo : planRes) {
- HomeToDoQueryResVo home = new HomeToDoQueryResVo();
- BeanUtils.copyProperties(planVo, home);
- homeRes.add(home);
- }
- }
- return AjaxResult.success(homeRes);
- }
- /**
- * 统计分析-采购项目信息统计
- *
- * @param pmDemandReqVo
- * @return
- */
- @Override
- public Map<String, Integer> purchaseProjectStatistical(PmDemandReqVo pmDemandReqVo) {
- Map<String, Integer> mapReturn = new HashMap<>();
- // 查询项目总数量
- Map<String, Integer> mapCount = pmDemandMapper.purchaseProjectStatistical(pmDemandReqVo);
- // 查询已完成项目数量,预算(合同)金额数量
- Map<String, Integer> mapYWC = pmDemandMapper.purchaseProjectStatisticalYWC(pmDemandReqVo);
- // 查询新创建项目数量,预算金额数量
- Map<String, Integer> mapXCJ = pmDemandMapper.purchaseProjectStatisticalXCJ(pmDemandReqVo);
- // 查询去年完成项目数量,预算(合同)金额数量
- Map<String, Integer> mapQNWC = pmDemandMapper.purchaseProjectStatisticalQNWC(pmDemandReqVo);
- mapReturn.putAll(mapCount);
- mapReturn.putAll(mapYWC);
- mapReturn.putAll(mapXCJ);
- mapReturn.putAll(mapQNWC);
- return mapReturn;
- }
- @Override
- public List<StatisticalChartsResVo> countByProjectAttr(PmDemandReqVo pmDemandReqVo) {
- List<StatisticalChartsResVo> resVos = pmDemandMapper.countByProjectAttr(pmDemandReqVo);
- for (StatisticalChartsResVo chartsResVo : resVos) {
- for (PmProjectStatus value : PmProjectStatus.values()) {
- if (value.getCode().equals(chartsResVo.getColumnName())) {
- chartsResVo.setColumnName(value.getInfo());
- break;
- }
- }
- }
- return resVos;
- }
- @Override
- public List<StatisticalChartsResVo> countByPurchaseMode(PmDemandReqVo pmDemandReqVo) {
- List<StatisticalChartsResVo> resVos = pmDemandMapper.countByPurchaseMode(pmDemandReqVo);
- for (StatisticalChartsResVo chartsResVo : resVos) {
- for (ProcurementMethodSuggest value : ProcurementMethodSuggest.values()) {
- if (value.getCode().equals(chartsResVo.getColumnName())) {
- chartsResVo.setColumnName(value.getInfo());
- break;
- }
- }
- }
- return resVos;
- }
- @Override
- public List<StatisticalChartsResVo> countByEvaluation(PmDemandReqVo pmDemandReqVo) {
- List<StatisticalChartsResVo> resVos = new ArrayList<>();
- //概算金额包括:100万以下采购任务、100至500万元采购任务、500至1000万元采购任务、1000至5000万元采购任务、5000至1亿元采购任务、1亿元及以上采购任务
- pmDemandReqVo.setEvaluation(100);
- StatisticalChartsResVo resVo = pmDemandMapper.countByEvaluationLt(pmDemandReqVo);
- resVo.setColumnName("100万以下采购任务");
- resVos.add(resVo);
- pmDemandReqVo.setEvaluation(100);
- pmDemandReqVo.setEvaluationEnd(500);
- StatisticalChartsResVo resVo1 = pmDemandMapper.countByEvaluationBet(pmDemandReqVo);
- resVo1.setColumnName("100至500万元采购任务");
- resVos.add(resVo1);
- pmDemandReqVo.setEvaluation(500);
- pmDemandReqVo.setEvaluationEnd(1000);
- StatisticalChartsResVo resVo2 = pmDemandMapper.countByEvaluationBet(pmDemandReqVo);
- resVo2.setColumnName("500至1000万元采购任务");
- resVos.add(resVo2);
- pmDemandReqVo.setEvaluation(1000);
- pmDemandReqVo.setEvaluationEnd(5000);
- StatisticalChartsResVo resVo3 = pmDemandMapper.countByEvaluationBet(pmDemandReqVo);
- resVo3.setColumnName("1000至5000万元采购任务");
- resVos.add(resVo3);
- pmDemandReqVo.setEvaluation(5000);
- pmDemandReqVo.setEvaluationEnd(10000);
- StatisticalChartsResVo resVo4 = pmDemandMapper.countByEvaluationBet(pmDemandReqVo);
- resVo4.setColumnName("5000至1亿元采购任务");
- resVos.add(resVo4);
- pmDemandReqVo.setEvaluation(10000);
- StatisticalChartsResVo resVo5 = pmDemandMapper.countByEvaluationGt(pmDemandReqVo);
- resVo5.setColumnName("1亿元及以上采购任务");
- resVos.add(resVo5);
- return resVos;
- }
- @Override
- public AjaxResult countProjectExceed(PmDemandReqVo pmDemandReqVo) {
- HashMap<String, String> resMap = new HashMap<>();
- //执行滞后采购项目:本年度所有的逾期项目数
- //预算金额:本年度所有逾期项目累加的预算金额
- StatisticalChartsResVo resVo = pmDemandMapper.countProjectExceed(pmDemandReqVo);
- resMap.put("执行滞后采购项目", resVo.getNum());
- resMap.put("预算金额", resVo.getEvaluationTotal());
- //滞后项目数量占比:指本年度逾期项目数量/本年度所有项目数量
- Integer thisYear = pmDemandMapper.countThisYear(pmDemandReqVo);
- resMap.put("滞后项目数量占比", getPercent(Integer.parseInt(resVo.getNum()), thisYear));
- return AjaxResult.success(resMap);
- }
- /**
- * 统计不同时间维度的逾期项目
- *
- * @return
- */
- @Override
- public AjaxResult exceedAnalysis(PmDemandReqVo pmDemandReqVo) {
- HashMap<String, List<StatisticalChartsResVo>> resMap = new HashMap<>();
- List<StatisticalChartsResVo> byYear = pmDemandMapper.countProjectExceedYear(pmDemandReqVo);
- if (pmDemandReqVo.getTimeType().equals("1")) {
- resMap.put("年", byYear);
- } else if (pmDemandReqVo.getTimeType().equals("2")) {
- List<StatisticalChartsResVo> byQuarter = new LinkedList<>();
- for (StatisticalChartsResVo chartsResVo : byYear) {
- pmDemandReqVo.setYear(Integer.parseInt(chartsResVo.getColumnName()));
- for (int i = 1; i <= 4; i++) {
- pmDemandReqVo.setQuarter(i);
- StatisticalChartsResVo quarter = pmDemandMapper.countProjectExceedQuarter(pmDemandReqVo);
- if (ObjectUtils.isEmpty(quarter)) {
- StatisticalChartsResVo vo = new StatisticalChartsResVo("", "0", "0");
- quarter = vo;
- quarter.setColumnName(chartsResVo.getColumnName() + "年第" + i + "季度");
- }
- quarter.setColumnName(chartsResVo.getColumnName() + "年第" + i + "季度");
- byQuarter.add(quarter);
- }
- }
- resMap.put("季度", byQuarter);
- } else if (pmDemandReqVo.getTimeType().equals("3")) {
- List<StatisticalChartsResVo> byMonth = new LinkedList<>();
- for (StatisticalChartsResVo chartsResVo : byYear) {
- pmDemandReqVo.setYear(Integer.parseInt(chartsResVo.getColumnName()));
- for (int i = 1; i <= 12; i++) {
- pmDemandReqVo.setMonth(i);
- StatisticalChartsResVo month = pmDemandMapper.countProjectExceedMonth(pmDemandReqVo);
- if (ObjectUtils.isEmpty(month)) {
- StatisticalChartsResVo vo = new StatisticalChartsResVo("", "0", "0");
- month = vo;
- month.setColumnName(chartsResVo.getColumnName() + "年" + i + "月");
- }
- month.setColumnName(chartsResVo.getColumnName() + "年" + i + "月");
- byMonth.add(month);
- }
- }
- resMap.put("月", byMonth);
- }
- return AjaxResult.success(resMap);
- }
- @Override
- public AjaxResult taskQuantityAnalysis(PmDemandReqVo pmDemandReqVo) {
- HashMap<String, List<StatisticalChartsResVo>> resMap = new HashMap<>();
- //任务数量趋势分析:按照月、季度、年统计“项目属性”字段中“重大规划”属性的项目
- List<StatisticalChartsResVo> byYear = pmDemandMapper.countProjectMajorByYear();
- if (pmDemandReqVo.getTimeType().equals("1")) {
- resMap.put("年", byYear);
- } else if (pmDemandReqVo.getTimeType().equals("2")) {
- List<StatisticalChartsResVo> byQuarter = new LinkedList<>();
- for (StatisticalChartsResVo chartsResVo : byYear) {
- pmDemandReqVo.setYear(Integer.parseInt(chartsResVo.getColumnName()));
- for (int i = 1; i <= 4; i++) {
- pmDemandReqVo.setQuarter(i);
- StatisticalChartsResVo quarter = pmDemandMapper.countProjectMajorByQuarter(pmDemandReqVo);
- quarter.setColumnName(chartsResVo.getColumnName() + "年第" + i + "季度");
- byQuarter.add(quarter);
- }
- }
- resMap.put("季度", byQuarter);
- } else if (pmDemandReqVo.getTimeType().equals("3")) {
- List<StatisticalChartsResVo> byMonth = pmDemandMapper.countProjectMajorByMonth(pmDemandReqVo);
- resMap.put("月", byMonth);
- }
- return AjaxResult.success(resMap);
- }
- @Override
- public AjaxResult countEveryStatusNum(PmDemandReqVo pmDemandReqVo) {
- //指项目进行到各个阶段的数量
- //阶段包括:待选取代理、待上传招标文件、待发布公告、待开标、待发布中标公告、中标公式中
- List<StatisticalChartsResVo> everyStatusNum = pmDemandMapper.countEveryStatusNum(pmDemandReqVo);
- if (!ObjectUtils.isEmpty(everyStatusNum) && everyStatusNum.size() > 0) {
- for (StatisticalChartsResVo vo : everyStatusNum) {
- switch (vo.getColumnName()) {
- case "9":
- vo.setColumnName(PmProjectStatus.WAIT_SELECT_AGENT.getInfo());
- break;
- case "10":
- vo.setColumnName(PmProjectStatus.WAIT_UPLOAD_BID_FILE.getInfo());
- break;
- case "11":
- vo.setColumnName(PmProjectStatus.WAIT_ANNOUNCEMENT.getInfo());
- break;
- case "12":
- vo.setColumnName(PmProjectStatus.WAIT_OPEN_BID.getInfo());
- break;
- case "13":
- vo.setColumnName(PmProjectStatus.WAIT_BID_ANNOUNCEMENT.getInfo());
- break;
- case "14":
- vo.setColumnName(PmProjectStatus.BIDDING_PUBLICITY.getInfo());
- break;
- default: {
- }
- }
- }
- }
- return AjaxResult.success(everyStatusNum);
- }
- @Override
- public AjaxResult exceedMarketAnalysis(PmDemandReqVo pmDemandReqVo) {
- //所有滞后
- List<PmDemand> demandList = pmDemandMapper.countProjectExceedAll(pmDemandReqVo);
- //滞后时长包括:滞后1个月以内的采购任务、滞后1至3个月采购任务、滞后3至6个月采购任务、滞后6个月至1年采购任务、滞后1年以上采购任务
- HashMap<String, Integer> map = new LinkedHashMap<>();
- map.put("滞后1个月以内的采购任务", 0);
- map.put("滞后1至3个月采购任务", 0);
- map.put("滞后3至6个月采购任务", 0);
- map.put("滞后6个月至1年采购任务", 0);
- map.put("滞后1年以上采购任务", 0);
- if (!ObjectUtils.isEmpty(demandList) && demandList.size() > 0) {
- for (PmDemand demand : demandList) {
- //滞后时间
- Long exTime = null;
- if (!ObjectUtils.isEmpty(demand.getRealDemandCommitTime()) && demand.getRealDemandCommitTime().getTime() - demand.getPlanDemandSubTime().getTime() > 0) {
- exTime = demand.getRealDemandCommitTime().getTime() - demand.getPlanDemandSubTime().getTime();
- } else if (!ObjectUtils.isEmpty(demand.getRealPurchaseFinishTime()) && demand.getRealPurchaseFinishTime().getTime() - demand.getPlanPurchaseFinishTime().getTime() > 0) {
- exTime = demand.getRealPurchaseFinishTime().getTime() - demand.getPlanPurchaseFinishTime().getTime();
- } else if (!ObjectUtils.isEmpty(demand.getRealDeliverTime()) && demand.getRealDeliverTime().getTime() - demand.getPlanDeliverTime().getTime() > 0) {
- exTime = demand.getRealDeliverTime().getTime() - demand.getPlanDeliverTime().getTime();
- }
- if (exTime < Long.valueOf("2592000000")) {
- map.put("滞后1个月以内的采购任务", map.get("滞后1个月以内的采购任务") + 1);
- }
- if (exTime >= Long.valueOf("2592000000") && exTime < Long.valueOf("7776000000")) {
- map.put("滞后1至3个月采购任务", map.get("滞后1至3个月采购任务") + 1);
- }
- if (exTime >= Long.valueOf("7776000000") && exTime < Long.valueOf("15552000000")) {
- map.put("滞后3至6个月采购任务", map.get("滞后3至6个月采购任务") + 1);
- }
- if (exTime >= Long.valueOf("15552000000") && exTime < Long.valueOf("31104000000")) {
- map.put("滞后6个月至1年采购任务", map.get("滞后6个月至1年采购任务") + 1);
- }
- if (exTime > Long.valueOf("31104000000")) {
- map.put("滞后1年以上采购任务", map.get("滞后1年以上采购任务") + 1);
- }
- }
- }
- return AjaxResult.success(map);
- }
- @Override
- public AjaxResult countMajorProject(PmDemandReqVo pmDemandReqVo) {
- List<StatisticalChartsResVo> resVos = new ArrayList<>();
- //数量:指本年度状态为“项目建设完成”的项目属性为“重大规划”的项目数
- //预算金额:指本年度状态为“项目建设完成”的项目属性为“重大规划”的项目累加的预算金额
- StatisticalChartsResVo resVo = new StatisticalChartsResVo();
- pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.COMPLETION_CONSTRUCTION.getCode()));
- resVo = pmDemandMapper.majorProjectByStatus(pmDemandReqVo);
- resVo.setColumnName("今年已完成数量");
- resVos.add(resVo);
- //正常推进项目:指本年度正在进行中的项目属性为“重大规划”的项目数
- //预算金额:指本年度正在进行中的项目属性为“重大规划”的项目累加的预算金额
- StatisticalChartsResVo resVo1 = new StatisticalChartsResVo();
- pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.UNDER_CONSTRUCTION.getCode()));
- resVo1 = pmDemandMapper.majorProjectByStatus(pmDemandReqVo);
- resVo1.setColumnName("正常推进数量");
- resVos.add(resVo1);
- //执行滞后数量:指本年度逾期项目中,项目属性为“重大规划”的项目数
- //预算金额:指本年度正在进行中的项目属性为“重大规划”的项目累加的预算金额
- StatisticalChartsResVo resVo2 = new StatisticalChartsResVo();
- resVo2 = pmDemandMapper.countMajorProjectExceed(pmDemandReqVo);
- resVo2.setColumnName("执行滞后数量");
- resVos.add(resVo2);
- //上年度重大规划采购任务数量:指上年度项目中,项目属性为“重大规划”的项目数
- //预算金额:指上年度项目中,项目属性为“重大规划”的项目累加的预算(合同)金额
- StatisticalChartsResVo resVo3 = new StatisticalChartsResVo();
- resVo3 = pmDemandMapper.countMajorProjectLastYear(pmDemandReqVo);
- resVo3.setColumnName("上年度重大规划采购任务数量");
- resVos.add(resVo3);
- //resVo2=pmDemandMapper.majorProjectByStatus(PmProjectStatus.COMPLETION_CONSTRUCTION.getCode());
- return AjaxResult.success(resVos);
- }
- /**
- * 通过计划ID查询项目数据
- *
- * @param planId
- * @return
- */
- @Override
- public PmDemand selectByPlanId(Long planId) {
- return pmDemandMapper.selectByPlanId(planId);
- }
- /**
- * 项目执行进度统计
- * 1、正常推进项目数量:指未完成并且没有逾期的项目
- * 预算金额:指未完成并且没有逾期的项目累加的预算金额
- * 2、未完成采购任务:“合同待填制”状态之前的项目
- * 预算金额:“合同待填制”状态之前的项目累加的预算金额
- *
- * @param pmDemandReqVo
- * @return
- */
- @Override
- public Map<String, Integer> purchaseProjectExecute(PmDemandReqVo pmDemandReqVo) {
- Map<String, Integer> mapReturn = new HashMap<>();
- // 正常推进项目数量、预算金额
- Map<String, Integer> mapNormalPropulsion = pmDemandMapper.purchaseProjectExecuteNormalPropulsion(pmDemandReqVo);
- // 未完成采购任务,预算金额
- Map<String, Integer> mapIncomplete = pmDemandMapper.purchaseProjectExecuteIncomplete(pmDemandReqVo);
- mapReturn.putAll(mapNormalPropulsion);
- mapReturn.putAll(mapIncomplete);
- return mapReturn;
- }
- /**
- * 已完成项目数量统计
- *
- * @param pmDemandReqVo
- * @return
- */
- @Override
- public List<Map<String, Integer>> purchaseProjectCompleteNumber(PmDemandReqVo pmDemandReqVo) {
- List<Map<String, Integer>> mapReturn = new ArrayList<>();
- // 统计时间类型 1:年度,2:季度,3:月份
- if ("1".equals(pmDemandReqVo.getTimeType())) {
- // 查询数据库中最小的年份
- int minYear = pmDemandMapper.selectMinYear();
- // 获取当前年份
- Calendar calendar = Calendar.getInstance();
- int year = calendar.get(Calendar.YEAR);
- // 获取统计数据
- List<Map<String, Integer>> listMap = pmDemandMapper.selectpurchaseProjectCompleteNumberYear(pmDemandReqVo);
- mapReturn.addAll(listMap);
- for (int i = minYear; i <= year; i++) {
- boolean isYear = false;
- for (Map<String, Integer> map : listMap) {
- if (i == Integer.parseInt(String.valueOf(map.get("yy")))) {
- isYear = true;
- }
- }
- if (!isYear) {
- Map<String, Integer> map1 = new HashMap<>();
- map1.put("yy", i);
- map1.put("evaluation", 0);
- map1.put("contractAmount", 0);
- map1.put("countNum", 0);
- mapReturn.add(map1);
- }
- }
- } else if ("2".equals(pmDemandReqVo.getTimeType())) {
- // 当前年份季度统计
- // 获取统计数据
- List<Map<String, Integer>> listMap = pmDemandMapper.selectpurchaseProjectCompleteNumberQuarter(pmDemandReqVo);
- mapReturn.addAll(listMap);
- for (int i = 1; i <= 4; i++) {
- boolean isYear = false;
- for (Map<String, Integer> map : listMap) {
- if (i == Integer.parseInt(String.valueOf(map.get("yy")))) {
- isYear = true;
- }
- }
- if (!isYear) {
- Map<String, Integer> map1 = new HashMap<>();
- map1.put("yy", i);
- map1.put("evaluation", 0);
- map1.put("contractAmount", 0);
- map1.put("countNum", 0);
- mapReturn.add(map1);
- }
- }
- } else if ("3".equals(pmDemandReqVo.getTimeType())) {
- // 当前年份月份统计
- // 获取统计数据
- List<Map<String, Integer>> listMap = pmDemandMapper.selectpurchaseProjectCompleteNumberMonth(pmDemandReqVo);
- mapReturn.addAll(listMap);
- for (int i = 1; i <= 12; i++) {
- boolean isYear = false;
- for (Map<String, Integer> map : listMap) {
- if (i == Integer.parseInt(String.valueOf(map.get("yy")))) {
- isYear = true;
- }
- }
- if (!isYear) {
- Map<String, Integer> map1 = new HashMap<>();
- map1.put("yy", i);
- map1.put("evaluation", 0);
- map1.put("contractAmount", 0);
- map1.put("countNum", 0);
- mapReturn.add(map1);
- }
- }
- }
- return mapReturn;
- }
- /**
- * 已完成采购任务数量统计
- *
- * @param pmDemandReqVo
- * @return
- */
- @Override
- public List<Map<String, Integer>> purchaseTaskFinish(PmDemandReqVo pmDemandReqVo) {
- List<Map<String, Integer>> mapReturn = new ArrayList<>();
- // 统计时间类型 1:年度,2:季度,3:月份
- if ("1".equals(pmDemandReqVo.getTimeType())) {
- // 查询数据库中最小的年份
- int minYear = pmDemandMapper.selectMinYear();
- // 获取当前年份
- Calendar calendar = Calendar.getInstance();
- int year = calendar.get(Calendar.YEAR);
- // 获取统计数据
- List<Map<String, Integer>> listMap = pmDemandMapper.selectPurchaseTaskFinishYear(pmDemandReqVo);
- mapReturn.addAll(listMap);
- for (int i = minYear; i <= year; i++) {
- boolean isYear = false;
- for (Map<String, Integer> map : listMap) {
- if (i == Integer.parseInt(String.valueOf(map.get("yy")))) {
- isYear = true;
- }
- }
- if (!isYear) {
- Map<String, Integer> map1 = new HashMap<>();
- map1.put("yy", i);
- map1.put("evaluation", 0);
- map1.put("contractAmount", 0);
- map1.put("countNum", 0);
- mapReturn.add(map1);
- }
- }
- } else if ("2".equals(pmDemandReqVo.getTimeType())) {
- // 当前年份季度统计
- // 获取统计数据
- List<Map<String, Integer>> listMap = pmDemandMapper.selectPurchaseTaskFinishQuarter(pmDemandReqVo);
- mapReturn.addAll(listMap);
- for (int i = 1; i <= 4; i++) {
- boolean isYear = false;
- for (Map<String, Integer> map : listMap) {
- if (i == Integer.parseInt(String.valueOf(map.get("yy")))) {
- isYear = true;
- }
- }
- if (!isYear) {
- Map<String, Integer> map1 = new HashMap<>();
- map1.put("yy", i);
- map1.put("evaluation", 0);
- map1.put("contractAmount", 0);
- map1.put("countNum", 0);
- mapReturn.add(map1);
- }
- }
- } else if ("3".equals(pmDemandReqVo.getTimeType())) {
- // 当前年份月份统计
- // 获取统计数据
- List<Map<String, Integer>> listMap = pmDemandMapper.selectPurchaseTaskFinishMonth(pmDemandReqVo);
- mapReturn.addAll(listMap);
- for (int i = 1; i <= 12; i++) {
- boolean isYear = false;
- for (Map<String, Integer> map : listMap) {
- if (i == Integer.parseInt(String.valueOf(map.get("yy")))) {
- isYear = true;
- }
- }
- if (!isYear) {
- Map<String, Integer> map1 = new HashMap<>();
- map1.put("yy", i);
- map1.put("evaluation", 0);
- map1.put("contractAmount", 0);
- map1.put("countNum", 0);
- mapReturn.add(map1);
- }
- }
- }
- return mapReturn;
- }
- /**
- * 各阶段项目数量分布
- *
- * @param pmDemandReqVo
- * @return
- */
- @Override
- public List<Map<String, String>> purchaseProjectDistribution(PmDemandReqVo pmDemandReqVo) {
- // 项目计划 4之前(包括4)
- List<String> xmjh = new ArrayList<>();
- xmjh.add("4");
- pmDemandReqVo.setProjectStatusList(xmjh);
- Map<String, String> returnMapxmjh = pmDemandMapper.purchaseProjectDistribution(pmDemandReqVo);
- returnMapxmjh.put("name", "计划管理");
- // 需求建党 4之后(不包括4)
- List<String> xqjd = new ArrayList<>();
- xqjd.add("5");
- xqjd.add("6");
- xqjd.add("7");
- xqjd.add("8");
- pmDemandReqVo.setProjectStatusList(xqjd);
- Map<String, String> returnMapxqjd = pmDemandMapper.purchaseProjectDistribution(pmDemandReqVo);
- returnMapxqjd.put("name", "需求管理");
- // 任务下达 8之后(不包括8)
- List<String> rwxd = new ArrayList<>();
- rwxd.add("9");
- pmDemandReqVo.setProjectStatusList(rwxd);
- Map<String, String> returnMaprwxd = pmDemandMapper.purchaseProjectDistribution(pmDemandReqVo);
- returnMaprwxd.put("name", "任务下达");
- // 采购执行 9之后(不包括9)
- List<String> cgzx = new ArrayList<>();
- cgzx.add("10");
- cgzx.add("11");
- cgzx.add("12");
- cgzx.add("13");
- cgzx.add("14");
- cgzx.add("15");
- pmDemandReqVo.setProjectStatusList(cgzx);
- Map<String, String> returnMapcgzx = pmDemandMapper.purchaseProjectDistribution(pmDemandReqVo);
- returnMapcgzx.put("name", "采购执行");
- // 合同管理 15之后(不包括15)
- List<String> htxx = new ArrayList<>();
- htxx.add("16");
- pmDemandReqVo.setProjectStatusList(htxx);
- Map<String, String> returnMaphtxx = pmDemandMapper.purchaseProjectDistribution(pmDemandReqVo);
- returnMaphtxx.put("name", "合同管理");
- // 项目建设 17
- List<String> xmjs = new ArrayList<>();
- xmjs.add("16");
- pmDemandReqVo.setProjectStatusList(xmjs);
- Map<String, String> returnMapxmjs = pmDemandMapper.purchaseProjectDistribution(pmDemandReqVo);
- returnMapxmjs.put("name", "合同管理");
- List<Map<String, String>> returnMap = new ArrayList<>();
- returnMap.add(returnMapxmjh);
- returnMap.add(returnMapxqjd);
- returnMap.add(returnMaprwxd);
- returnMap.add(returnMapcgzx);
- returnMap.add(returnMaphtxx);
- returnMap.add(returnMapxmjs);
- return returnMap;
- }
- /**
- * 项目数量分析---------年度的同比和环比不展示-----------
- *
- * @param pmDemandReqVo
- * @return
- */
- @Override
- public List<Map<String, String>> purchaseProjectNumberAnalysis(PmDemandReqVo pmDemandReqVo) {
- List<Map<String, String>> mapReturn = new ArrayList<>();
- // 统计时间类型 1:年度,2:季度,3:月份
- if ("1".equals(pmDemandReqVo.getTimeType())) {
- // 查询数据库中最小的年份
- int minYear = pmDemandMapper.selectMinYear();
- // 获取当前年份
- Calendar calendar = Calendar.getInstance();
- int year = calendar.get(Calendar.YEAR);
- // 获取统计数据
- // 获取项目统计
- List<Map<String, String>> listMap = pmDemandMapper.purchaseProjectNumberAnalysisYear(pmDemandReqVo);
- mapReturn.addAll(listMap);
- for (int i = minYear; i <= year; i++) {
- boolean isYear = false;
- for (Map<String, String> map : listMap) {
- if (i == Integer.parseInt(String.valueOf(map.get("yy")))) {
- isYear = true;
- }
- }
- if (!isYear) {
- Map<String, String> map1 = new HashMap<>();
- map1.put("yy", i + "");
- map1.put("countNum", 0 + "");
- map1.put("evaluationSum", 0 + "");
- mapReturn.add(map1);
- }
- }
- } else if ("2".equals(pmDemandReqVo.getTimeType())) {
- // 当前年份季度统计
- // 获取统计数据
- List<Map<String, String>> listMap = pmDemandMapper.purchaseProjectNumberAnalysisQuarter(pmDemandReqVo);
- List<Map<String, String>> mapList = new ArrayList<>();
- mapList.addAll(listMap);
- for (int i = 1; i <= 4; i++) {
- boolean isYear = false;
- for (Map<String, String> map : listMap) {
- if (i == Integer.parseInt(String.valueOf(map.get("yy")))) {
- isYear = true;
- }
- }
- if (!isYear) {
- Map<String, String> map1 = new HashMap<>();
- map1.put("yy", i + "");
- map1.put("countNum", 0 + "");
- map1.put("evaluationSum", 0 + "");
- mapList.add(map1);
- }
- }
- Map<String, String> map1 = new HashMap<>();
- Map<String, String> map2 = new HashMap<>();
- Map<String, String> map3 = new HashMap<>();
- Map<String, String> map4 = new HashMap<>();
- for (Map<String, String> map : mapList) {
- String yy = String.valueOf(map.get("yy"));
- if ("1".equals(yy)) {
- map1.putAll(map);
- } else if ("2".equals(yy)) {
- map2.putAll(map);
- } else if ("3".equals(yy)) {
- map3.putAll(map);
- } else if ("4".equals(yy)) {
- map4.putAll(map);
- }
- }
- String countNum1 = String.valueOf(map1.get("countNum"));
- String countNum2 = String.valueOf(map2.get("countNum"));
- String countNum3 = String.valueOf(map3.get("countNum"));
- String countNum4 = String.valueOf(map4.get("countNum"));
- String evaluationSum1 = String.valueOf(map1.get("evaluationSum"));
- String evaluationSum2 = String.valueOf(map2.get("evaluationSum"));
- String evaluationSum3 = String.valueOf(map3.get("evaluationSum"));
- String evaluationSum4 = String.valueOf(map4.get("evaluationSum"));
- // 查询上一年四季度数据
- List<Map<String, String>> listMapOldYear = pmDemandMapper.purchaseProjectNumberAnalysisOldYearQuarter(pmDemandReqVo);
- List<Map<String, String>> mapListOld = new ArrayList<>();
- mapListOld.addAll(listMapOldYear);
- for (int i = 1; i <= 4; i++) {
- boolean isYear = false;
- for (Map<String, String> map : listMapOldYear) {
- if (i == Integer.parseInt(String.valueOf(map.get("yy")))) {
- isYear = true;
- }
- }
- if (!isYear) {
- Map<String, String> map11 = new HashMap<>();
- map11.put("yy", i + "");
- map11.put("countNum", 0 + "");
- map11.put("evaluationSum", 0 + "");
- mapListOld.add(map11);
- }
- }
- Map<String, String> mapOld1 = new HashMap<>();
- Map<String, String> mapOld2 = new HashMap<>();
- Map<String, String> mapOld3 = new HashMap<>();
- Map<String, String> mapOld4 = new HashMap<>();
- for (Map<String, String> mapOld : mapListOld) {
- String yy = String.valueOf(mapOld.get("yy"));
- if ("1".equals(yy)) {
- mapOld1.putAll(mapOld);
- } else if ("2".equals(yy)) {
- mapOld2.putAll(mapOld);
- } else if ("3".equals(yy)) {
- mapOld3.putAll(mapOld);
- } else if ("4".equals(yy)) {
- mapOld4.putAll(mapOld);
- }
- }
- String countNumOld1 = String.valueOf(mapOld1.get("countNum"));
- String countNumOld2 = String.valueOf(mapOld2.get("countNum"));
- String countNumOld3 = String.valueOf(mapOld3.get("countNum"));
- String countNumOld4 = String.valueOf(mapOld4.get("countNum"));
- String evaluationSumOld1 = String.valueOf(mapOld1.get("evaluationSum"));
- String evaluationSumOld2 = String.valueOf(mapOld2.get("evaluationSum"));
- String evaluationSumOld3 = String.valueOf(mapOld3.get("evaluationSum"));
- String evaluationSumOld4 = String.valueOf(mapOld4.get("evaluationSum"));
- BigDecimal countNum11 = new BigDecimal(countNum1);
- BigDecimal countNum22 = new BigDecimal(countNum2);
- BigDecimal countNum33 = new BigDecimal(countNum3);
- BigDecimal countNum44 = new BigDecimal(countNum4);
- BigDecimal countNumOld11 = new BigDecimal(countNumOld1);
- BigDecimal countNumOld22 = new BigDecimal(countNumOld2);
- BigDecimal countNumOld33 = new BigDecimal(countNumOld3);
- BigDecimal countNumOld44 = new BigDecimal(countNumOld4);
- BigDecimal evaluationSum11 = new BigDecimal(evaluationSum1);
- BigDecimal evaluationSum22 = new BigDecimal(evaluationSum2);
- BigDecimal evaluationSum33 = new BigDecimal(evaluationSum3);
- BigDecimal evaluationSum44 = new BigDecimal(evaluationSum4);
- BigDecimal evaluationSumOld11 = new BigDecimal(evaluationSumOld1);
- BigDecimal evaluationSumOld22 = new BigDecimal(evaluationSumOld2);
- BigDecimal evaluationSumOld33 = new BigDecimal(evaluationSumOld3);
- BigDecimal evaluationSumOld44 = new BigDecimal(evaluationSumOld4);
- // 项目数量环比 对比
- BigDecimal monthonmonthNum1 = new BigDecimal(0.00);
- BigDecimal monthonmonthNum2 = new BigDecimal(0.00);
- BigDecimal monthonmonthNum3 = new BigDecimal(0.00);
- BigDecimal monthonmonthNum4 = new BigDecimal(0.00);
- if (!"0".equals(countNumOld4)) {
- monthonmonthNum1 = (countNum11.subtract(countNumOld44)).divide(countNumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNum1)) {
- monthonmonthNum2 = (countNum22.subtract(countNum11)).divide(countNum11, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNum2)) {
- monthonmonthNum3 = (countNum33.subtract(countNum22)).divide(countNum22, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNum3)) {
- monthonmonthNum4 = (countNum44.subtract(countNum33)).divide(countNum33, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- map1.put("monthonmonthNum", monthonmonthNum1.toString());
- map2.put("monthonmonthNum", monthonmonthNum2.toString());
- map3.put("monthonmonthNum", monthonmonthNum3.toString());
- map4.put("monthonmonthNum", monthonmonthNum4.toString());
- // 项目数量同比 对比
- BigDecimal yearonyearNum1 = new BigDecimal(0.00);
- BigDecimal yearonyearNum2 = new BigDecimal(0.00);
- BigDecimal yearonyearNum3 = new BigDecimal(0.00);
- BigDecimal yearonyearNum4 = new BigDecimal(0.00);
- if (!"0".equals(countNumOld1)) {
- yearonyearNum1 = (countNum11.subtract(countNumOld11)).divide(countNumOld11, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNumOld2)) {
- yearonyearNum2 = (countNum22.subtract(countNumOld22)).divide(countNumOld22, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNumOld3)) {
- yearonyearNum3 = (countNum33.subtract(countNumOld33)).divide(countNumOld33, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNumOld4)) {
- yearonyearNum4 = (countNum44.subtract(countNumOld44)).divide(countNumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- map1.put("yearonyearNum", yearonyearNum1.toString());
- map2.put("yearonyearNum", yearonyearNum2.toString());
- map3.put("yearonyearNum", yearonyearNum3.toString());
- map4.put("yearonyearNum", yearonyearNum4.toString());
- // 预算金额环比 对比
- BigDecimal monthonmonthAmount1 = new BigDecimal(0.00);
- BigDecimal monthonmonthAmount2 = new BigDecimal(0.00);
- BigDecimal monthonmonthAmount3 = new BigDecimal(0.00);
- BigDecimal monthonmonthAmount4 = new BigDecimal(0.00);
- if (!"0".equals(evaluationSumOld4)) {
- monthonmonthAmount1 = (evaluationSum11.subtract(evaluationSumOld44)).divide(evaluationSumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSum1)) {
- monthonmonthAmount2 = (evaluationSum22.subtract(evaluationSum11)).divide(evaluationSum11, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSum2)) {
- monthonmonthAmount3 = (evaluationSum33.subtract(evaluationSum22)).divide(evaluationSum22, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSum3)) {
- monthonmonthAmount4 = (evaluationSum44.subtract(evaluationSum33)).divide(evaluationSum33, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- map1.put("monthonmonthAmount", monthonmonthAmount1.toString());
- map2.put("monthonmonthAmount", monthonmonthAmount2.toString());
- map3.put("monthonmonthAmount", monthonmonthAmount3.toString());
- map4.put("monthonmonthAmount", monthonmonthAmount4.toString());
- // 预算金额同比比 对比
- BigDecimal yearonyearAmount1 = new BigDecimal(0.00);
- BigDecimal yearonyearAmount2 = new BigDecimal(0.00);
- BigDecimal yearonyearAmount3 = new BigDecimal(0.00);
- BigDecimal yearonyearAmount4 = new BigDecimal(0.00);
- if (!"0".equals(evaluationSumOld1)) {
- yearonyearAmount1 = (evaluationSum11.subtract(evaluationSumOld11)).divide(evaluationSumOld11, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSumOld2)) {
- yearonyearAmount2 = (evaluationSum22.subtract(evaluationSumOld22)).divide(evaluationSumOld22, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSumOld3)) {
- yearonyearAmount3 = (evaluationSum33.subtract(evaluationSumOld33)).divide(evaluationSumOld33, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSumOld4)) {
- yearonyearAmount4 = (evaluationSum44.subtract(evaluationSumOld44)).divide(evaluationSumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- map1.put("yearonyearAmount", yearonyearAmount1.toString());
- map2.put("yearonyearAmount", yearonyearAmount2.toString());
- map3.put("yearonyearAmount", yearonyearAmount3.toString());
- map4.put("yearonyearAmount", yearonyearAmount4.toString());
- // 存入集合
- mapReturn.add(map1);
- mapReturn.add(map2);
- mapReturn.add(map3);
- mapReturn.add(map4);
- } else if ("3".equals(pmDemandReqVo.getTimeType())) {
- // 当前年份月份统计
- // 获取统计数据
- List<Map<String, String>> listMap = pmDemandMapper.purchaseProjectNumberAnalysisMonth(pmDemandReqVo);
- List<Map<String, String>> mapList = new ArrayList<>();
- mapList.addAll(listMap);
- for (int i = 1; i <= 12; i++) {
- boolean isYear = false;
- for (Map<String, String> map : listMap) {
- String yy = String.valueOf(map.get("yy"));
- String yyNew = yy.replaceAll("^0*", "");
- if (i == Integer.valueOf(yyNew)) {
- isYear = true;
- }
- }
- if (!isYear) {
- Map<String, String> map1 = new HashMap<>();
- String yy = String.format("%02d", i);
- map1.put("yy", yy);
- map1.put("countNum", 0 + "");
- map1.put("evaluationSum", 0 + "");
- mapList.add(map1);
- }
- }
- Map<String, String> map1 = new HashMap<>();
- Map<String, String> map2 = new HashMap<>();
- Map<String, String> map3 = new HashMap<>();
- Map<String, String> map4 = new HashMap<>();
- Map<String, String> map5 = new HashMap<>();
- Map<String, String> map6 = new HashMap<>();
- Map<String, String> map7 = new HashMap<>();
- Map<String, String> map8 = new HashMap<>();
- Map<String, String> map9 = new HashMap<>();
- Map<String, String> map10 = new HashMap<>();
- Map<String, String> map11 = new HashMap<>();
- Map<String, String> map12 = new HashMap<>();
- for (Map<String, String> map : mapList) {
- String yy = String.valueOf(map.get("yy"));
- if ("01".equals(yy)) {
- map1.putAll(map);
- } else if ("02".equals(yy)) {
- map2.putAll(map);
- } else if ("03".equals(yy)) {
- map3.putAll(map);
- } else if ("04".equals(yy)) {
- map4.putAll(map);
- } else if ("05".equals(yy)) {
- map5.putAll(map);
- } else if ("06".equals(yy)) {
- map6.putAll(map);
- } else if ("07".equals(yy)) {
- map7.putAll(map);
- } else if ("08".equals(yy)) {
- map8.putAll(map);
- } else if ("09".equals(yy)) {
- map9.putAll(map);
- } else if ("10".equals(yy)) {
- map10.putAll(map);
- } else if ("11".equals(yy)) {
- map11.putAll(map);
- } else if ("12".equals(yy)) {
- map12.putAll(map);
- }
- }
- String countNum1 = String.valueOf(map1.get("countNum"));
- String countNum2 = String.valueOf(map2.get("countNum"));
- String countNum3 = String.valueOf(map3.get("countNum"));
- String countNum4 = String.valueOf(map4.get("countNum"));
- String countNum5 = String.valueOf(map5.get("countNum"));
- String countNum6 = String.valueOf(map6.get("countNum"));
- String countNum7 = String.valueOf(map7.get("countNum"));
- String countNum8 = String.valueOf(map8.get("countNum"));
- String countNum9 = String.valueOf(map9.get("countNum"));
- String countNum10 = String.valueOf(map10.get("countNum"));
- String countNum11 = String.valueOf(map11.get("countNum"));
- String countNum12 = String.valueOf(map12.get("countNum"));
- String evaluationSum1 = String.valueOf(map1.get("evaluationSum"));
- String evaluationSum2 = String.valueOf(map2.get("evaluationSum"));
- String evaluationSum3 = String.valueOf(map3.get("evaluationSum"));
- String evaluationSum4 = String.valueOf(map4.get("evaluationSum"));
- String evaluationSum5 = String.valueOf(map5.get("evaluationSum"));
- String evaluationSum6 = String.valueOf(map6.get("evaluationSum"));
- String evaluationSum7 = String.valueOf(map7.get("evaluationSum"));
- String evaluationSum8 = String.valueOf(map8.get("evaluationSum"));
- String evaluationSum9 = String.valueOf(map9.get("evaluationSum"));
- String evaluationSum10 = String.valueOf(map10.get("evaluationSum"));
- String evaluationSum11 = String.valueOf(map11.get("evaluationSum"));
- String evaluationSum12 = String.valueOf(map12.get("evaluationSum"));
- // 查询上一年月份数据
- List<Map<String, String>> listMapOldMonth = pmDemandMapper.purchaseProjectNumberAnalysisOldYearMonth(pmDemandReqVo);
- List<Map<String, String>> mapListOld = new ArrayList<>();
- mapListOld.addAll(listMapOldMonth);
- for (int i = 1; i <= 12; i++) {
- boolean isYear = false;
- for (Map<String, String> map : listMapOldMonth) {
- String yy = String.valueOf(map.get("yy"));
- String yyNew = yy.replaceAll("^0*", "");
- if (i == Integer.valueOf(yyNew)) {
- isYear = true;
- }
- }
- if (!isYear) {
- Map<String, String> map111 = new HashMap<>();
- String yy = String.format("%02d", i);
- map111.put("yy", yy);
- map111.put("countNum", 0 + "");
- map111.put("evaluationSum", 0 + "");
- mapListOld.add(map111);
- }
- }
- Map<String, String> mapOld1 = new HashMap<>();
- Map<String, String> mapOld2 = new HashMap<>();
- Map<String, String> mapOld3 = new HashMap<>();
- Map<String, String> mapOld4 = new HashMap<>();
- Map<String, String> mapOld5 = new HashMap<>();
- Map<String, String> mapOld6 = new HashMap<>();
- Map<String, String> mapOld7 = new HashMap<>();
- Map<String, String> mapOld8 = new HashMap<>();
- Map<String, String> mapOld9 = new HashMap<>();
- Map<String, String> mapOld10 = new HashMap<>();
- Map<String, String> mapOld11 = new HashMap<>();
- Map<String, String> mapOld12 = new HashMap<>();
- for (Map<String, String> mapOld : mapListOld) {
- String yy = String.valueOf(mapOld.get("yy"));
- if ("01".equals(yy)) {
- mapOld1.putAll(mapOld);
- } else if ("02".equals(yy)) {
- mapOld2.putAll(mapOld);
- } else if ("03".equals(yy)) {
- mapOld3.putAll(mapOld);
- } else if ("04".equals(yy)) {
- mapOld4.putAll(mapOld);
- } else if ("05".equals(yy)) {
- mapOld5.putAll(mapOld);
- } else if ("06".equals(yy)) {
- mapOld6.putAll(mapOld);
- } else if ("07".equals(yy)) {
- mapOld7.putAll(mapOld);
- } else if ("08".equals(yy)) {
- mapOld8.putAll(mapOld);
- } else if ("09".equals(yy)) {
- mapOld9.putAll(mapOld);
- } else if ("10".equals(yy)) {
- mapOld10.putAll(mapOld);
- } else if ("11".equals(yy)) {
- mapOld11.putAll(mapOld);
- } else if ("12".equals(yy)) {
- mapOld12.putAll(mapOld);
- }
- }
- String countNumOld1 = String.valueOf(mapOld1.get("countNum"));
- String countNumOld2 = String.valueOf(mapOld2.get("countNum"));
- String countNumOld3 = String.valueOf(mapOld3.get("countNum"));
- String countNumOld4 = String.valueOf(mapOld4.get("countNum"));
- String countNumOld5 = String.valueOf(mapOld5.get("countNum"));
- String countNumOld6 = String.valueOf(mapOld6.get("countNum"));
- String countNumOld7 = String.valueOf(mapOld7.get("countNum"));
- String countNumOld8 = String.valueOf(mapOld8.get("countNum"));
- String countNumOld9 = String.valueOf(mapOld9.get("countNum"));
- String countNumOld10 = String.valueOf(mapOld10.get("countNum"));
- String countNumOld11 = String.valueOf(mapOld11.get("countNum"));
- String countNumOld12 = String.valueOf(mapOld12.get("countNum"));
- String evaluationSumOld1 = String.valueOf(mapOld1.get("evaluationSum"));
- String evaluationSumOld2 = String.valueOf(mapOld2.get("evaluationSum"));
- String evaluationSumOld3 = String.valueOf(mapOld3.get("evaluationSum"));
- String evaluationSumOld4 = String.valueOf(mapOld4.get("evaluationSum"));
- String evaluationSumOld5 = String.valueOf(mapOld5.get("evaluationSum"));
- String evaluationSumOld6 = String.valueOf(mapOld6.get("evaluationSum"));
- String evaluationSumOld7 = String.valueOf(mapOld7.get("evaluationSum"));
- String evaluationSumOld8 = String.valueOf(mapOld8.get("evaluationSum"));
- String evaluationSumOld9 = String.valueOf(mapOld9.get("evaluationSum"));
- String evaluationSumOld10 = String.valueOf(mapOld10.get("evaluationSum"));
- String evaluationSumOld11 = String.valueOf(mapOld11.get("evaluationSum"));
- String evaluationSumOld12 = String.valueOf(mapOld12.get("evaluationSum"));
- BigDecimal countNum111 = new BigDecimal(countNum1);
- BigDecimal countNum22 = new BigDecimal(countNum2);
- BigDecimal countNum33 = new BigDecimal(countNum3);
- BigDecimal countNum44 = new BigDecimal(countNum4);
- BigDecimal countNum55 = new BigDecimal(countNum5);
- BigDecimal countNum66 = new BigDecimal(countNum6);
- BigDecimal countNum77 = new BigDecimal(countNum7);
- BigDecimal countNum88 = new BigDecimal(countNum8);
- BigDecimal countNum99 = new BigDecimal(countNum9);
- BigDecimal countNum1010 = new BigDecimal(countNum10);
- BigDecimal countNum1111 = new BigDecimal(countNum11);
- BigDecimal countNum1212 = new BigDecimal(countNum12);
- BigDecimal countNumOld111 = new BigDecimal(countNumOld1);
- BigDecimal countNumOld22 = new BigDecimal(countNumOld2);
- BigDecimal countNumOld33 = new BigDecimal(countNumOld3);
- BigDecimal countNumOld44 = new BigDecimal(countNumOld4);
- BigDecimal countNumOld55 = new BigDecimal(countNumOld5);
- BigDecimal countNumOld66 = new BigDecimal(countNumOld6);
- BigDecimal countNumOld77 = new BigDecimal(countNumOld7);
- BigDecimal countNumOld88 = new BigDecimal(countNumOld8);
- BigDecimal countNumOld99 = new BigDecimal(countNumOld9);
- BigDecimal countNumOld1010 = new BigDecimal(countNumOld10);
- BigDecimal countNumOld1111 = new BigDecimal(countNumOld11);
- BigDecimal countNumOld1212 = new BigDecimal(countNumOld12);
- BigDecimal evaluationSum111 = new BigDecimal(evaluationSum1);
- BigDecimal evaluationSum22 = new BigDecimal(evaluationSum2);
- BigDecimal evaluationSum33 = new BigDecimal(evaluationSum3);
- BigDecimal evaluationSum44 = new BigDecimal(evaluationSum4);
- BigDecimal evaluationSum55 = new BigDecimal(evaluationSum5);
- BigDecimal evaluationSum66 = new BigDecimal(evaluationSum6);
- BigDecimal evaluationSum77 = new BigDecimal(evaluationSum7);
- BigDecimal evaluationSum88 = new BigDecimal(evaluationSum8);
- BigDecimal evaluationSum99 = new BigDecimal(evaluationSum9);
- BigDecimal evaluationSum1010 = new BigDecimal(evaluationSum10);
- BigDecimal evaluationSum1111 = new BigDecimal(evaluationSum11);
- BigDecimal evaluationSum1212 = new BigDecimal(evaluationSum12);
- BigDecimal evaluationSumOld111 = new BigDecimal(evaluationSumOld1);
- BigDecimal evaluationSumOld22 = new BigDecimal(evaluationSumOld2);
- BigDecimal evaluationSumOld33 = new BigDecimal(evaluationSumOld3);
- BigDecimal evaluationSumOld44 = new BigDecimal(evaluationSumOld4);
- BigDecimal evaluationSumOld55 = new BigDecimal(evaluationSumOld5);
- BigDecimal evaluationSumOld66 = new BigDecimal(evaluationSumOld6);
- BigDecimal evaluationSumOld77 = new BigDecimal(evaluationSumOld7);
- BigDecimal evaluationSumOld88 = new BigDecimal(evaluationSumOld8);
- BigDecimal evaluationSumOld99 = new BigDecimal(evaluationSumOld9);
- BigDecimal evaluationSumOld1010 = new BigDecimal(evaluationSumOld10);
- BigDecimal evaluationSumOld1111 = new BigDecimal(evaluationSumOld11);
- BigDecimal evaluationSumOld1212 = new BigDecimal(evaluationSumOld12);
- // 项目数量环比 对比
- BigDecimal monthonmonthNum1 = new BigDecimal(0.00);
- BigDecimal monthonmonthNum2 = new BigDecimal(0.00);
- BigDecimal monthonmonthNum3 = new BigDecimal(0.00);
- BigDecimal monthonmonthNum4 = new BigDecimal(0.00);
- BigDecimal monthonmonthNum5 = new BigDecimal(0.00);
- BigDecimal monthonmonthNum6 = new BigDecimal(0.00);
- BigDecimal monthonmonthNum7 = new BigDecimal(0.00);
- BigDecimal monthonmonthNum8 = new BigDecimal(0.00);
- BigDecimal monthonmonthNum9 = new BigDecimal(0.00);
- BigDecimal monthonmonthNum10 = new BigDecimal(0.00);
- BigDecimal monthonmonthNum11 = new BigDecimal(0.00);
- BigDecimal monthonmonthNum12 = new BigDecimal(0.00);
- if (!"0".equals(countNumOld12)) {
- monthonmonthNum1 = (countNum111.subtract(countNumOld1212)).divide(countNumOld1212, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNum1)) {
- monthonmonthNum2 = (countNum22.subtract(countNum111)).divide(countNum111, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNum2)) {
- monthonmonthNum3 = (countNum33.subtract(countNum22)).divide(countNum22, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNum3)) {
- monthonmonthNum4 = (countNum44.subtract(countNum33)).divide(countNum33, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNum4)) {
- monthonmonthNum5 = (countNum55.subtract(countNum44)).divide(countNum44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNum5)) {
- monthonmonthNum6 = (countNum66.subtract(countNum55)).divide(countNum55, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNum6)) {
- monthonmonthNum7 = (countNum77.subtract(countNum66)).divide(countNum66, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNum7)) {
- monthonmonthNum8 = (countNum88.subtract(countNum77)).divide(countNum77, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNum8)) {
- monthonmonthNum9 = (countNum99.subtract(countNum88)).divide(countNum88, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNum9)) {
- monthonmonthNum10 = (countNum1010.subtract(countNum99)).divide(countNum99, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNum10)) {
- monthonmonthNum11 = (countNum1111.subtract(countNum1010)).divide(countNum1010, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNum11)) {
- monthonmonthNum12 = (countNum1212.subtract(countNum1111)).divide(countNum1111, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- map1.put("monthonmonthNum", monthonmonthNum1.toString());
- map2.put("monthonmonthNum", monthonmonthNum2.toString());
- map3.put("monthonmonthNum", monthonmonthNum3.toString());
- map4.put("monthonmonthNum", monthonmonthNum4.toString());
- map5.put("monthonmonthNum", monthonmonthNum5.toString());
- map6.put("monthonmonthNum", monthonmonthNum6.toString());
- map7.put("monthonmonthNum", monthonmonthNum7.toString());
- map8.put("monthonmonthNum", monthonmonthNum8.toString());
- map9.put("monthonmonthNum", monthonmonthNum9.toString());
- map10.put("monthonmonthNum", monthonmonthNum10.toString());
- map11.put("monthonmonthNum", monthonmonthNum11.toString());
- map12.put("monthonmonthNum", monthonmonthNum12.toString());
- // 项目数量同比 对比
- BigDecimal yearonyearNum1 = new BigDecimal(0.00);
- BigDecimal yearonyearNum2 = new BigDecimal(0.00);
- BigDecimal yearonyearNum3 = new BigDecimal(0.00);
- BigDecimal yearonyearNum4 = new BigDecimal(0.00);
- BigDecimal yearonyearNum5 = new BigDecimal(0.00);
- BigDecimal yearonyearNum6 = new BigDecimal(0.00);
- BigDecimal yearonyearNum7 = new BigDecimal(0.00);
- BigDecimal yearonyearNum8 = new BigDecimal(0.00);
- BigDecimal yearonyearNum9 = new BigDecimal(0.00);
- BigDecimal yearonyearNum10 = new BigDecimal(0.00);
- BigDecimal yearonyearNum11 = new BigDecimal(0.00);
- BigDecimal yearonyearNum12 = new BigDecimal(0.00);
- if (!"0".equals(countNumOld1)) {
- yearonyearNum1 = (countNum111.subtract(countNumOld111)).divide(countNumOld111, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNumOld2)) {
- yearonyearNum2 = (countNum22.subtract(countNumOld22)).divide(countNumOld22, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNumOld3)) {
- yearonyearNum3 = (countNum33.subtract(countNumOld33)).divide(countNumOld33, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNumOld4)) {
- yearonyearNum4 = (countNum44.subtract(countNumOld44)).divide(countNumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNumOld5)) {
- yearonyearNum5 = (countNum55.subtract(countNumOld55)).divide(countNumOld55, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNumOld6)) {
- yearonyearNum6 = (countNum66.subtract(countNumOld66)).divide(countNumOld66, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNumOld7)) {
- yearonyearNum7 = (countNum77.subtract(countNumOld77)).divide(countNumOld77, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNumOld8)) {
- yearonyearNum8 = (countNum88.subtract(countNumOld88)).divide(countNumOld88, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNumOld9)) {
- yearonyearNum9 = (countNum99.subtract(countNumOld99)).divide(countNumOld99, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNumOld10)) {
- yearonyearNum10 = (countNum1010.subtract(countNumOld1010)).divide(countNumOld1010, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNumOld11)) {
- yearonyearNum11 = (countNum1111.subtract(countNumOld1111)).divide(countNumOld1111, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(countNumOld12)) {
- yearonyearNum12 = (countNum1212.subtract(countNumOld1212)).divide(countNumOld1212, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- map1.put("yearonyearNum", yearonyearNum1.toString());
- map2.put("yearonyearNum", yearonyearNum2.toString());
- map3.put("yearonyearNum", yearonyearNum3.toString());
- map4.put("yearonyearNum", yearonyearNum4.toString());
- map5.put("yearonyearNum", yearonyearNum5.toString());
- map6.put("yearonyearNum", yearonyearNum6.toString());
- map7.put("yearonyearNum", yearonyearNum7.toString());
- map8.put("yearonyearNum", yearonyearNum8.toString());
- map9.put("yearonyearNum", yearonyearNum9.toString());
- map10.put("yearonyearNum", yearonyearNum10.toString());
- map11.put("yearonyearNum", yearonyearNum11.toString());
- map12.put("yearonyearNum", yearonyearNum12.toString());
- // 预算金额环比 对比
- BigDecimal monthonmonthAmount1 = new BigDecimal(0.00);
- BigDecimal monthonmonthAmount2 = new BigDecimal(0.00);
- BigDecimal monthonmonthAmount3 = new BigDecimal(0.00);
- BigDecimal monthonmonthAmount4 = new BigDecimal(0.00);
- BigDecimal monthonmonthAmount5 = new BigDecimal(0.00);
- BigDecimal monthonmonthAmount6 = new BigDecimal(0.00);
- BigDecimal monthonmonthAmount7 = new BigDecimal(0.00);
- BigDecimal monthonmonthAmount8 = new BigDecimal(0.00);
- BigDecimal monthonmonthAmount9 = new BigDecimal(0.00);
- BigDecimal monthonmonthAmount10 = new BigDecimal(0.00);
- BigDecimal monthonmonthAmount11 = new BigDecimal(0.00);
- BigDecimal monthonmonthAmount12 = new BigDecimal(0.00);
- if (!"0".equals(evaluationSumOld12)) {
- monthonmonthAmount1 = (evaluationSum111.subtract(evaluationSumOld1212)).divide(evaluationSumOld1212, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSum1)) {
- monthonmonthAmount2 = (evaluationSum22.subtract(evaluationSum111)).divide(evaluationSum111, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSum2)) {
- monthonmonthAmount3 = (evaluationSum33.subtract(evaluationSum22)).divide(evaluationSum22, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSum3)) {
- monthonmonthAmount4 = (evaluationSum44.subtract(evaluationSum33)).divide(evaluationSum33, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSum4)) {
- monthonmonthAmount5 = (evaluationSum55.subtract(evaluationSum44)).divide(evaluationSum44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSum5)) {
- monthonmonthAmount6 = (evaluationSum66.subtract(evaluationSum55)).divide(evaluationSum55, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSum6)) {
- monthonmonthAmount7 = (evaluationSum77.subtract(evaluationSum66)).divide(evaluationSum66, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSum7)) {
- monthonmonthAmount8 = (evaluationSum88.subtract(evaluationSum77)).divide(evaluationSum77, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSum8)) {
- monthonmonthAmount9 = (evaluationSum99.subtract(evaluationSum88)).divide(evaluationSum88, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSum9)) {
- monthonmonthAmount10 = (evaluationSum1010.subtract(evaluationSum99)).divide(evaluationSum99, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSum10)) {
- monthonmonthAmount11 = (evaluationSum1111.subtract(evaluationSum1010)).divide(evaluationSum1010, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSum11)) {
- monthonmonthAmount12 = (evaluationSum1212.subtract(evaluationSum1111)).divide(evaluationSum1111, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- map1.put("monthonmonthAmount", monthonmonthAmount1.toString());
- map2.put("monthonmonthAmount", monthonmonthAmount2.toString());
- map3.put("monthonmonthAmount", monthonmonthAmount3.toString());
- map4.put("monthonmonthAmount", monthonmonthAmount4.toString());
- map5.put("monthonmonthAmount", monthonmonthAmount5.toString());
- map6.put("monthonmonthAmount", monthonmonthAmount6.toString());
- map7.put("monthonmonthAmount", monthonmonthAmount7.toString());
- map8.put("monthonmonthAmount", monthonmonthAmount8.toString());
- map9.put("monthonmonthAmount", monthonmonthAmount9.toString());
- map10.put("monthonmonthAmount", monthonmonthAmount10.toString());
- map11.put("monthonmonthAmount", monthonmonthAmount11.toString());
- map12.put("monthonmonthAmount", monthonmonthAmount12.toString());
- // 预算金额同比比 对比
- BigDecimal yearonyearAmount1 = new BigDecimal(0.00);
- BigDecimal yearonyearAmount2 = new BigDecimal(0.00);
- BigDecimal yearonyearAmount3 = new BigDecimal(0.00);
- BigDecimal yearonyearAmount4 = new BigDecimal(0.00);
- BigDecimal yearonyearAmount5 = new BigDecimal(0.00);
- BigDecimal yearonyearAmount6 = new BigDecimal(0.00);
- BigDecimal yearonyearAmount7 = new BigDecimal(0.00);
- BigDecimal yearonyearAmount8 = new BigDecimal(0.00);
- BigDecimal yearonyearAmount9 = new BigDecimal(0.00);
- BigDecimal yearonyearAmount10 = new BigDecimal(0.00);
- BigDecimal yearonyearAmount11 = new BigDecimal(0.00);
- BigDecimal yearonyearAmount12 = new BigDecimal(0.00);
- if (!"0".equals(evaluationSumOld1)) {
- yearonyearAmount1 = (evaluationSum111.subtract(evaluationSumOld111)).divide(evaluationSumOld1111, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSumOld2)) {
- yearonyearAmount2 = (evaluationSum22.subtract(evaluationSumOld22)).divide(evaluationSumOld22, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSumOld3)) {
- yearonyearAmount3 = (evaluationSum33.subtract(evaluationSumOld33)).divide(evaluationSumOld33, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSumOld4)) {
- yearonyearAmount4 = (evaluationSum44.subtract(evaluationSumOld44)).divide(evaluationSumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSumOld5)) {
- yearonyearAmount5 = (evaluationSum55.subtract(evaluationSumOld55)).divide(evaluationSumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSumOld6)) {
- yearonyearAmount6 = (evaluationSum66.subtract(evaluationSumOld66)).divide(evaluationSumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSumOld7)) {
- yearonyearAmount7 = (evaluationSum77.subtract(evaluationSumOld77)).divide(evaluationSumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSumOld8)) {
- yearonyearAmount8 = (evaluationSum88.subtract(evaluationSumOld88)).divide(evaluationSumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSumOld9)) {
- yearonyearAmount9 = (evaluationSum99.subtract(evaluationSumOld99)).divide(evaluationSumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSumOld10)) {
- yearonyearAmount10 = (evaluationSum1010.subtract(evaluationSumOld1010)).divide(evaluationSumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSumOld11)) {
- yearonyearAmount11 = (evaluationSum1111.subtract(evaluationSumOld1111)).divide(evaluationSumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- if (!"0".equals(evaluationSumOld12)) {
- yearonyearAmount12 = (evaluationSum1212.subtract(evaluationSumOld1212)).divide(evaluationSumOld44, 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- map1.put("yearonyearAmount", yearonyearAmount1.toString());
- map2.put("yearonyearAmount", yearonyearAmount2.toString());
- map3.put("yearonyearAmount", yearonyearAmount3.toString());
- map4.put("yearonyearAmount", yearonyearAmount4.toString());
- map5.put("yearonyearAmount", yearonyearAmount5.toString());
- map6.put("yearonyearAmount", yearonyearAmount6.toString());
- map7.put("yearonyearAmount", yearonyearAmount7.toString());
- map8.put("yearonyearAmount", yearonyearAmount8.toString());
- map9.put("yearonyearAmount", yearonyearAmount9.toString());
- map10.put("yearonyearAmount", yearonyearAmount10.toString());
- map11.put("yearonyearAmount", yearonyearAmount11.toString());
- map12.put("yearonyearAmount", yearonyearAmount12.toString());
- // 存入集合
- mapReturn.add(map1);
- mapReturn.add(map2);
- mapReturn.add(map3);
- mapReturn.add(map4);
- mapReturn.add(map5);
- mapReturn.add(map6);
- mapReturn.add(map7);
- mapReturn.add(map8);
- mapReturn.add(map9);
- mapReturn.add(map10);
- mapReturn.add(map11);
- mapReturn.add(map12);
- }
- return mapReturn;
- }
- //查询不同状态下的项目数据
- public List<PmDemandResVo> getListByStatus(String projectStatus) {
- LambdaQueryWrapper<PmDemand> lw = new LambdaQueryWrapper<PmDemand>();
- lw.eq(PmDemand::getProjectStatus, projectStatus);
- List<PmDemand> demandList = this.baseMapper.selectList(lw);
- //数据转换
- List<PmDemandResVo> pmDemandResponseVoList = new ArrayList<>();
- if (!ObjectUtils.isEmpty(demandList) && demandList.size() > 0) {
- pmDemandResponseVoList = demandChangeTo(demandList);
- }
- return pmDemandResponseVoList;
- }
- //字段转换and赋值
- public List<PmDemandResVo> demandChangeTo(List<PmDemand> pmDemandList) {
- List<PmDemandResVo> pmDemandResponseVoList = new ArrayList<>();
- for (PmDemand pmDemand1 : pmDemandList) {
- PmDemandResVo vo = new PmDemandResVo();
- BeanUtils.copyProperties(pmDemand1, vo);
- if (vo.getPurchaseDeptId() != null) {
- Map<String, Object> deptMap = deptService.selectDeptById(vo.getPurchaseDeptId());
- if (deptMap != null) {
- SysDeptResponseVo sysDeptResponseVo = (SysDeptResponseVo) deptMap.get("sysDept");
- if (sysDeptResponseVo != null) {
- vo.setPurchaseDeptName(sysDeptResponseVo.getDeptName());
- }
- }
- }
- String purchaseServicesName = dictDataService.selectDictLabel("purchase_services", vo.getPurchaseServices());
- if (StringUtils.isNotEmpty(purchaseServicesName)) {
- vo.setPurchaseServicesName(purchaseServicesName);
- }
- //项目类型
- for (ProjectTypes value : ProjectTypes.values()) {
- if (vo.getProjectType() != null && vo.getProjectType().equals(value.getCode())) {
- vo.setProjectTypeName(value.getInfo());
- break;
- }
- }
- //是否为超限额计划
- for (IsExcess value : IsExcess.values()) {
- if (vo.getIsExcess() != null && vo.getIsExcess().equals(value.getCode())) {
- vo.setIsExcessName(value.getInfo());
- break;
- }
- }
- //采购方式
- for (PlanPurchaseMode value : PlanPurchaseMode.values()) {
- if (vo.getPurchaseMode() != null && vo.getPurchaseMode().equals(value.getCode())) {
- vo.setPurchaseModeName(value.getInfo());
- break;
- }
- }
- //项目属性
- for (ProjectAttribute value : ProjectAttribute.values()) {
- if (vo.getProjectAttr() != null && vo.getProjectAttr().equals(value.getCode())) {
- vo.setProjectAttrName(value.getInfo());
- break;
- }
- }
- //预警状态
- for (WarnStatus value : WarnStatus.values()) {
- if (vo.getWarnStatus() != null && vo.getWarnStatus().equals(value.getCode())) {
- vo.setWarnStatusName(value.getInfo());
- break;
- }
- }
- //项目状态
- for (PmProjectStatus value : PmProjectStatus.values()) {
- if (vo.getProjectStatus() != null && vo.getProjectStatus().equals(value.getCode())) {
- vo.setProjectStatusName(value.getInfo());
- break;
- }
- }
- try {
- vo.setTipsMessage(pmDemandGetTips(vo.getPlanDeliverTime()));
- if (vo.getTipsMessage().contains("超过")) {
- vo.setIsExceedProject("1");
- if (ObjectUtils.isEmpty(pmDemand1.getDelayReason())) {
- //没有原因就可以填写滞后原因
- vo.setIsWriteExceed("1");
- }
- }
- } catch (ParseException e) {
- e.printStackTrace();
- }
- pmDemandResponseVoList.add(vo);
- }
- return pmDemandResponseVoList;
- }
- /**
- * 根据年度计划提报时间的阈值进行提示
- *
- * @return
- */
- public String pmDemandGetTips(Date planDeliverTime) throws ParseException {
- if (!ObjectUtils.isEmpty(planDeliverTime)) {
- //提示信息:定义距离结束时间一周内提示
- Integer remindTine = 1000 * 60 * 60 * 24 * 7;
- //少于一周便提醒
- double surplus = planDeliverTime.getTime() - System.currentTimeMillis();
- if (surplus < remindTine) {
- int i = new Double(Math.ceil(surplus / 1000 / 60 / 60 / 24)).intValue();
- //剩余天数(向上取整)
- if (i > 0) {
- return "距离计划交付时间不足" + i + "天";
- } else {
- return "已超过计划完成时间" + Math.abs(i) + "天";
- }
- }
- }
- return "";
- }
- /**
- * 计算百分比:使用java.text.DecimalFormat实现
- *
- * @param x
- * @param y
- * @return
- */
- public static String getPercent(int x, int y) {
- double d1 = x * 1.0;
- double d2 = y * 1.0;
- // 设置保留几位小数, “.”后面几个零就保留几位小数,这里设置保留2位小数
- DecimalFormat decimalFormat = new DecimalFormat("##.00%");
- return decimalFormat.format(d1 / d2);
- }
- }
|