package com.ozs.pm.service.impl; 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.BaseAgency; import com.ozs.base.domain.BaseExpert; import com.ozs.base.domain.BaseNotice; import com.ozs.base.domain.BaseNoticeType; import com.ozs.base.domain.BaseUnitInformation; import com.ozs.base.domain.vo.BaseExpertVo; import com.ozs.base.mapper.BaseExpertMapper; import com.ozs.base.service.BaseAgencyService; import com.ozs.base.service.BaseExpertService; import com.ozs.base.service.BaseNoticeService; import com.ozs.base.service.BaseNoticeTypeService; import com.ozs.common.constant.Constants; import com.ozs.common.core.domain.AjaxResult; import com.ozs.common.core.domain.entity.SysDept; import com.ozs.common.core.domain.entity.SysDictData; import com.ozs.common.core.domain.entity.SysRole; import com.ozs.common.core.domain.entity.SysUser; import com.ozs.common.core.domain.model.LoginUser; import com.ozs.common.enums.BidWinningStatus; import com.ozs.common.enums.ExpertType; import com.ozs.common.enums.IsExcess; import com.ozs.common.enums.NameListType; import com.ozs.common.enums.PlanPurchaseMode; import com.ozs.common.enums.PmProjectStatus; import com.ozs.common.enums.ProcurementMethodSuggest; import com.ozs.common.enums.ProjectAttribute; import com.ozs.common.enums.ProjectTypes; import com.ozs.common.enums.SysFileRefEnum; import com.ozs.common.enums.WarnStatus; 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.PlanYears; import com.ozs.plan.doman.ProvisionalPlan; import com.ozs.plan.doman.vo.responseVo.PlanQuarterResponseVo; import com.ozs.plan.mapper.ProvisionalPlanMapper; import com.ozs.plan.service.PlanYearsService; import com.ozs.pm.doman.PmAuditDeptRef; import com.ozs.pm.doman.PmBidFailure; import com.ozs.pm.doman.PmBidOpening; import com.ozs.pm.doman.PmBidWinning; import com.ozs.pm.doman.PmBidWinningOpeningRef; import com.ozs.pm.doman.PmBookBuilding; import com.ozs.pm.doman.PmCallQuestion; import com.ozs.pm.doman.PmContractInfo; import com.ozs.pm.doman.PmDemand; import com.ozs.pm.doman.PmDemandExpertRef; import com.ozs.pm.doman.PmExpertFeedback; import com.ozs.pm.doman.PmProcurementDocumentsReview; import com.ozs.pm.doman.PmProjectConstruction; import com.ozs.pm.doman.PmReleaseAnnouncement; import com.ozs.pm.doman.vo.requestVo.PmBaseExpertExtractReqVo; import com.ozs.pm.doman.vo.requestVo.PmBaseExpertFillReqVo; import com.ozs.pm.doman.vo.requestVo.PmBidFailureReqVo; import com.ozs.pm.doman.vo.requestVo.PmBidOpeningFillReqVo; import com.ozs.pm.doman.vo.requestVo.PmBidWinningReqVo; import com.ozs.pm.doman.vo.requestVo.PmBookBuildingReqVo; import com.ozs.pm.doman.vo.requestVo.PmContractInfoReqVo; import com.ozs.pm.doman.vo.requestVo.PmDemandReqVo; import com.ozs.pm.doman.vo.requestVo.PmProjectConstructionReqVo; import com.ozs.pm.doman.vo.requestVo.PmReleaseAnnouncementReqVo; import com.ozs.pm.doman.vo.responseVo.PmBaseExpertResVo; import com.ozs.pm.doman.vo.responseVo.PmBidFailureResVo; import com.ozs.pm.doman.vo.responseVo.PmBidOpeningResVo; import com.ozs.pm.doman.vo.responseVo.PmBidWinningResVo; import com.ozs.pm.doman.vo.responseVo.PmBookBuildingResVo; import com.ozs.pm.doman.vo.responseVo.PmCallQuestionResVo; import com.ozs.pm.doman.vo.responseVo.PmContractInfoResVo; import com.ozs.pm.doman.vo.responseVo.PmDemandResVo; import com.ozs.pm.doman.vo.responseVo.PmExpertFeedbackResVo; import com.ozs.pm.doman.vo.responseVo.PmProcurementDocumentsReviewResVo; import com.ozs.pm.doman.vo.responseVo.PmProjectConstructionResVo; import com.ozs.pm.doman.vo.responseVo.PmPurchaseExecutionResVo; import com.ozs.pm.doman.vo.responseVo.PmReleaseAnnouncementResVo; import com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo; import com.ozs.pm.mapper.PmDemandMapper; import com.ozs.pm.service.IPmDemandService; import com.ozs.pm.service.PmAuditDeptRefService; import com.ozs.pm.service.PmBidFailureService; import com.ozs.pm.service.PmBidOpeningService; import com.ozs.pm.service.PmBidWinningOpeningRefService; import com.ozs.pm.service.PmBidWinningService; import com.ozs.pm.service.PmBookBuildingService; import com.ozs.pm.service.PmCallQuestionHisService; import com.ozs.pm.service.PmCallQuestionService; import com.ozs.pm.service.PmContractInfoService; import com.ozs.pm.service.PmDemandExpertRefService; import com.ozs.pm.service.PmExpertFeedbackService; import com.ozs.pm.service.PmProcurementDocumentsReviewService; import com.ozs.pm.service.PmProjectConstructionService; import com.ozs.pm.service.PmReleaseAnnouncementService; 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.SysFileRefMapper; import com.ozs.system.mapper.SysRoleMapper; import com.ozs.system.service.ISysDeptService; import com.ozs.system.service.ISysDictDataService; import com.ozs.system.service.ISysDictTypeService; import com.ozs.system.service.ISysRegionService; import com.ozs.system.service.ISysUserService; import com.ozs.system.service.SysFileRefService; import com.ozs.system.service.SysFileService; 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.ObjectUtils; import java.math.BigDecimal; import java.text.DecimalFormat; import java.text.ParseException; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; /** * 采购需求Service业务层处理 * * @author ruoyi * @date 2023-01-16 */ @Service @Slf4j public class PmDemandServiceImpl extends ServiceImpl implements IPmDemandService { @Autowired private PmDemandMapper pmDemandMapper; @Autowired private ISysDeptService deptService; @Autowired private SysRoleMapper sysRoleMapper; @Autowired private ISysDictDataService dictDataService; @Autowired private ISysDictTypeService dictTypeService; @Autowired private SysFileService fileService; @Autowired private SysFileRefService sysFileRefService; @Autowired private PmReleaseAnnouncementService pmReleaseAnnouncementService; @Autowired private BaseExpertService baseExpertService; @Autowired private PmDemandExpertRefService pmDemandExpertRefService; @Autowired private PmBidOpeningService pmBidOpeningService; @Autowired private SysFileRefMapper sysFileRefMapper; @Autowired private PmBookBuildingService pmBookBuildingService; @Autowired private PmCallQuestionService pmCallQuestionService; @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 ISysUserService userService; @Autowired private SysDeptMapper deptMapper; @Autowired private BaseExpertMapper baseExpertMapper; @Autowired private PmAuditDeptRefService pmAuditDeptRefService; @Autowired private ProvisionalPlanMapper provisionalPlanMapper; @Autowired private PmExpertFeedbackService pmExpertFeedbackService; @Autowired private PmProcurementDocumentsReviewService pmProcurementDocumentsReviewService; @Autowired private PmCallQuestionHisService questionHisService; /** * 查询采购需求 * * @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); //project_type,evaluation 从原来计划里取 ProvisionalPlan provisionalPlan = provisionalPlanMapper.seletById(pmDemand.getPlanId()); if (provisionalPlan != null) { vo.setProjectType(provisionalPlan.getProjectType()); vo.setEvaluation(provisionalPlan.getEvaluation().doubleValue()); } 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 demandFileInfos = getSysFileInfoList(vo.getDemandId(), SysFileRefEnum.PM_DEMAND.getType()); if (!ObjectUtils.isEmpty(demandFileInfos)) { vo.setDemandFileInfos(demandFileInfos); } //项目类型 String projectTypeName = dictDataService.selectDictLabel("sys_project_type", vo.getProjectType()); if (StringUtils.isNotEmpty(projectTypeName)) { vo.setProjectTypeName(projectTypeName); } //是否为超限额计划 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 auditFileInfos = getSysFileInfoList(vo.getDemandId(), SysFileRefEnum.PM_DEMAND_EXAMINE.getType()); if (!ObjectUtils.isEmpty(auditFileInfos)) { vo.setAuditFileInfos(auditFileInfos); } LambdaQueryWrapper 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 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)) { //任务下达 vo.setTaskReleaseTime(pmDemand.getTaskReleaseTime()); //任务下达文件 List taskReleaseFileInfos = getSysFileInfoList(vo.getDemandId(), SysFileRefEnum.PM_TAST_RELEASE.getType()); if (!ObjectUtils.isEmpty(taskReleaseFileInfos)) { vo.setTaskReleaseFileInfos(taskReleaseFileInfos); } } else if ("4".equals(detailType)) { //中标信息 setPmPurchaseExecutionResVo(vo, pmDemand); } else if ("5".equals(detailType)) { //合同信息 setPmPurchaseExecutionResVo(vo, pmDemand); LambdaQueryWrapper 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 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 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 fileInfos = getSysFileInfoList(pmProjectConstruction.getId(), SysFileRefEnum.PM_PROJECT_CONSTRUCTION.getType()); if (!ObjectUtils.isEmpty(fileInfos)) { pmProjectConstructionResVo.setFileInfos(fileInfos); } vo.setPmProjectConstructionResVo(pmProjectConstructionResVo); } } return vo; } else { return null; } } private void setPmPurchaseExecutionResVo(PmDemandResVo vo, PmDemand pmDemand) { Long demandId = pmDemand.getDemandId(); PmPurchaseExecutionResVo pmPurchaseExecutionResVo = new PmPurchaseExecutionResVo(); //代理商信息 BaseAgency baseAgency = this.baseAgencyService.getById(pmDemand.getAgencyId()); List dictData = dictTypeService.selectDictDataByType(Constants.SYS_COMPANY_NATURE); for (SysDictData data : dictData) { if (data.getDictValue().equals(baseAgency.getCompanyNature())) { baseAgency.setCompanyNatureName(data.getDictLabel()); break; } } List dictDataT = dictTypeService.selectDictDataByType(Constants.SYS_PROJECT_TYPE); for (SysDictData data : dictDataT) { if (data.getDictValue().equals(baseAgency.getCompanyType() + "")) { baseAgency.setCompanyTypeName(data.getDictLabel()); break; } } pmPurchaseExecutionResVo.setBaseAgency(baseAgency); vo.setPurchaseTaskDocumentNumber(pmDemand.getPurchaseTaskDocumentNumber()); //专家意见反馈 LambdaQueryWrapper pmExpertFeedbackLambdaQueryWrapper = new LambdaQueryWrapper<>(); pmExpertFeedbackLambdaQueryWrapper.eq(PmExpertFeedback::getDemandId, demandId); PmExpertFeedback pmExpertFeedback = pmExpertFeedbackService.getOne(pmExpertFeedbackLambdaQueryWrapper); if (!ObjectUtils.isEmpty(pmExpertFeedback)) { PmExpertFeedbackResVo pmExpertFeedbackResVo = new PmExpertFeedbackResVo(); BeanUtils.copyProperties(pmExpertFeedback, pmExpertFeedbackResVo); List fileInfos = getSysFileInfoList(pmExpertFeedbackResVo.getId(), SysFileRefEnum.PM_EXPERT_FEEDBACK.getType()); if (!ObjectUtils.isEmpty(fileInfos)) { pmExpertFeedbackResVo.setFileInfos(fileInfos); } pmPurchaseExecutionResVo.setPmExpertFeedbackResVo(pmExpertFeedbackResVo); } //采购文件编制审核 LambdaQueryWrapper pmProcurementDocumentsReviewLambdaQueryWrapper = new LambdaQueryWrapper<>(); pmProcurementDocumentsReviewLambdaQueryWrapper.eq(PmProcurementDocumentsReview::getDemandId, demandId); PmProcurementDocumentsReview pmProcurementDocumentsReview = pmProcurementDocumentsReviewService.getOne(pmProcurementDocumentsReviewLambdaQueryWrapper); if (!ObjectUtils.isEmpty(pmProcurementDocumentsReview)) { PmProcurementDocumentsReviewResVo pmProcurementDocumentsReviewResVo = new PmProcurementDocumentsReviewResVo(); BeanUtils.copyProperties(pmProcurementDocumentsReview, pmProcurementDocumentsReviewResVo); List fileInfos = getSysFileInfoList(pmProcurementDocumentsReviewResVo.getId(), SysFileRefEnum.PM_BID_FILE.getType()); if (!ObjectUtils.isEmpty(fileInfos)) { pmProcurementDocumentsReviewResVo.setFileInfos(fileInfos); } pmPurchaseExecutionResVo.setPmProcurementDocumentsReviewResVo(pmProcurementDocumentsReviewResVo); } //采购公告列表 LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.eq(PmReleaseAnnouncement::getDemandId, demandId).orderByDesc(PmReleaseAnnouncement::getReleaseTime); List pmReleaseAnnouncementList = this.pmReleaseAnnouncementService.list(lambdaQueryWrapper); if (!ObjectUtils.isEmpty(pmReleaseAnnouncementList)) { List pmReleaseAnnouncementResVoList = new ArrayList<>(); List fileInfosAll = new ArrayList<>(); for (PmReleaseAnnouncement pmReleaseAnnouncement : pmReleaseAnnouncementList) { PmReleaseAnnouncementResVo pmReleaseAnnouncementResVo = new PmReleaseAnnouncementResVo(); BeanUtils.copyProperties(pmReleaseAnnouncement, pmReleaseAnnouncementResVo); List fileInfos = getSysFileInfoList(pmReleaseAnnouncementResVo.getId(), SysFileRefEnum.PM_ANNOUNCEMENT_FILE.getType()); if (!ObjectUtils.isEmpty(fileInfos)) { fileInfosAll.addAll(fileInfos); } pmReleaseAnnouncementResVoList.add(pmReleaseAnnouncementResVo); } pmPurchaseExecutionResVo.setPmReleaseAnnouncementFileInfos(fileInfosAll); pmPurchaseExecutionResVo.setPmReleaseAnnouncementResVoList(pmReleaseAnnouncementResVoList); } //标前质疑投诉 LambdaQueryWrapper pmCallQuestionLambdaQueryWrapper = new LambdaQueryWrapper<>(); pmCallQuestionLambdaQueryWrapper.eq(PmCallQuestion::getDemandId, demandId) .eq(PmCallQuestion::getType, '0').orderByDesc(PmCallQuestion::getCallQuestionTime); List pmCallQuestionList = pmCallQuestionService.list(pmCallQuestionLambdaQueryWrapper); if (!ObjectUtils.isEmpty(pmCallQuestionList)) { List pmCallQuestionResVoList = new ArrayList<>(); List fileInfosAll = new ArrayList<>(); for (PmCallQuestion pmCallQuestion : pmCallQuestionList) { PmCallQuestionResVo pmCallQuestionResVo = new PmCallQuestionResVo(); BeanUtils.copyProperties(pmCallQuestion, pmCallQuestionResVo); List fileInfos = getSysFileInfoList(pmCallQuestionResVo.getId(), SysFileRefEnum.PM_PRE_BID_CALL_QUESTION.getType()); if (!ObjectUtils.isEmpty(fileInfos)) { fileInfosAll.addAll(fileInfos); } pmCallQuestionResVoList.add(pmCallQuestionResVo); } pmPurchaseExecutionResVo.setPmCallQuestionPreResVoList(pmCallQuestionResVoList); pmPurchaseExecutionResVo.setPmCallQuestionPreFileInfos(fileInfosAll); } //专家信息列表 List pmBaseExpertResVoList = this.pmDemandExpertRefService.getPmBaseExpertResVoList(demandId); pmPurchaseExecutionResVo.setPmBaseExpertResVoList(pmBaseExpertResVoList); //开标信息列表 List pmBidOpeningResVoList = this.pmBidOpeningService.getPmBidOpeningResVoList(demandId); pmPurchaseExecutionResVo.setPmBidOpeningResVoList(pmBidOpeningResVoList); //评标结果公告列表 LambdaQueryWrapper lambdaQueryWrapper1 = new LambdaQueryWrapper<>(); lambdaQueryWrapper1.eq(PmBidWinning::getDemandId, demandId) .ne(PmBidWinning::getStatus, BidWinningStatus.BE_REPLACED.getCode()).orderByDesc(PmBidWinning::getBidAnnouncementTime); List pmBidWinningList = this.pmBidWinningService.list(lambdaQueryWrapper1); if (!ObjectUtils.isEmpty(pmBidWinningList)) { List pmBidWinningResVoList = new ArrayList<>(); List fileInfosAll = new ArrayList<>(); for (PmBidWinning pmBidWinning : pmBidWinningList) { PmBidWinningResVo pmBidWinningResVo = new PmBidWinningResVo(); BeanUtils.copyProperties(pmBidWinning, pmBidWinningResVo); pmBidWinningResVoList.add(pmBidWinningResVo); List fileInfos = getSysFileInfoList(pmBidWinningResVo.getId(), SysFileRefEnum.PM_BID_WINNING_FILE.getType()); if (!ObjectUtils.isEmpty(fileInfos)) { fileInfosAll.addAll(fileInfos); } } pmPurchaseExecutionResVo.setPmBidWinningResVoList(pmBidWinningResVoList); pmPurchaseExecutionResVo.setPmBidWinningFileInfos(fileInfosAll); } //标后质疑 LambdaQueryWrapper pmCallQuestionLambdaQueryWrapper2 = new LambdaQueryWrapper<>(); pmCallQuestionLambdaQueryWrapper2.eq(PmCallQuestion::getDemandId, demandId) .eq(PmCallQuestion::getType, '1').orderByDesc(PmCallQuestion::getCallQuestionTime); List pmCallQuestionList2 = pmCallQuestionService.list(pmCallQuestionLambdaQueryWrapper2); if (!ObjectUtils.isEmpty(pmCallQuestionList2)) { List pmCallQuestionResVoList = new ArrayList<>(); List fileInfosAll = new ArrayList<>(); for (PmCallQuestion pmCallQuestion : pmCallQuestionList2) { PmCallQuestionResVo pmCallQuestionResVo = new PmCallQuestionResVo(); BeanUtils.copyProperties(pmCallQuestion, pmCallQuestionResVo); List fileInfos = getSysFileInfoList(pmCallQuestionResVo.getId(), SysFileRefEnum.PM_BID_CALL_QEUSTION_FILE.getType()); if (!ObjectUtils.isEmpty(fileInfos)) { fileInfosAll.addAll(fileInfos); } pmCallQuestionResVoList.add(pmCallQuestionResVo); } pmPurchaseExecutionResVo.setPmCallQuestionPostResVoList(pmCallQuestionResVoList); pmPurchaseExecutionResVo.setPmCallRequestPostFileInfos(fileInfosAll); } //流标情况 LambdaQueryWrapper lambdaQueryWrapper2 = new LambdaQueryWrapper<>(); lambdaQueryWrapper2.eq(PmBidFailure::getDemandId, demandId).orderByDesc(PmBidFailure::getBidFailureTime); List pmBidFailureList = this.pmBidFailureService.list(lambdaQueryWrapper2); if (!ObjectUtils.isEmpty(pmBidFailureList)) { List pmBidFailureResVoList = new ArrayList<>(); List pmCallQuestionBidFailureResVoList = new ArrayList<>(); List pmBidFailureFileInfos = new ArrayList<>(); List pmCallRequestBidFailureFileInfos = new ArrayList<>(); for (PmBidFailure pmBidFailure : pmBidFailureList) { PmBidFailureResVo pmBidFailureResVo = new PmBidFailureResVo(); BeanUtils.copyProperties(pmBidFailure, pmBidFailureResVo); pmBidFailureResVoList.add(pmBidFailureResVo); //流标文件 List fileInfos = getSysFileInfoList(pmBidFailure.getId(), SysFileRefEnum.PM_BID_FAILURE_FILE.getType()); if (!ObjectUtils.isEmpty(fileInfos)) { pmBidFailureFileInfos.addAll(fileInfos); } if ("1".equals(pmBidFailure.getCallQuestion())) { //有质疑 PmCallQuestionResVo pmCallQuestionResVo = new PmCallQuestionResVo(); pmCallQuestionResVo.setCallQuestion(pmBidFailure.getCallQuestion()); pmCallQuestionResVo.setCallQuestionTime(pmBidFailure.getCallQuestionTime()); pmCallQuestionBidFailureResVoList.add(pmCallQuestionResVo); //流废标质疑文件 List fileInfos2 = getSysFileInfoList(pmBidFailure.getId(), SysFileRefEnum.PM_BID_FAILURE_CALL_QUESTION.getType()); if (!ObjectUtils.isEmpty(fileInfos2)) { pmCallRequestBidFailureFileInfos.addAll(fileInfos2); } } } pmPurchaseExecutionResVo.setPmBidFailureResVoList(pmBidFailureResVoList); pmPurchaseExecutionResVo.setPmBidFailureFileInfos(pmBidFailureFileInfos); //流废标处置 pmPurchaseExecutionResVo.setPmCallQuestionBidFailureResVoList(pmCallQuestionBidFailureResVoList); pmPurchaseExecutionResVo.setPmCallRequestBidFailureFileInfos(pmCallRequestBidFailureFileInfos); } //中标通知书 List pmBidWinningNotificationFileInfos = getSysFileInfoList(vo.getDemandId(), SysFileRefEnum.PM_BID_WINNING_NOTIFICATION.getType()); pmPurchaseExecutionResVo.setFileInfos(pmBidWinningNotificationFileInfos); vo.setUpAcceptanceTime(pmDemand.getUpAcceptanceTime()); vo.setPmPurchaseExecutionResVo(pmPurchaseExecutionResVo); } /** * 查询采购需求列表 * * @param pmDemandReqVo * @return 采购需求 */ @Override public IPage selectPmDemandList(PmDemandReqVo pmDemandReqVo, int reqType) { LambdaQueryWrapper lw = new LambdaQueryWrapper<>(); SysUser sysUser = userService.selectUserById(SecurityUtils.getUserId()); List list = new ArrayList<>(); LambdaQueryWrapper l = new LambdaQueryWrapper<>(); l.eq(PmAuditDeptRef::getDeptId, SecurityUtils.getDeptId()); l.eq(PmAuditDeptRef::getRefType, "2"); list = pmAuditDeptRefService.list(l); if (!pmDemandReqVo.getIsAdmin()) { if (1 == reqType) { if (!ObjectUtils.isEmpty(list)) { lw.in(PmDemand::getDemandId, list.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toSet())); } } else if (2 == reqType) { lw.in(PmDemand::getDemandId, list.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toSet())); lw.eq(PmDemand::getPurchaseDeptId, SecurityUtils.getDeptId()); } else if (3 == reqType) { //采购执行管理中,本单位超额项目交给上级处理,本单位不处理。 if (!ObjectUtils.isEmpty(list)) { // 如果有上级单位存在,本单位不处理 SysDept sysDept = deptMapper.selectDeptById(sysUser.getDeptId()); //本单位所有参与审核的项目id Set refList = new HashSet<>(); for (PmAuditDeptRef deptRef : list) { refList.add(deptRef.getRefId()); } //上级参与审核的项目 List refListf = new ArrayList<>(); List listf = new ArrayList<>(); if (sysDept.getParentId() != 0) { LambdaQueryWrapper lf = new LambdaQueryWrapper<>(); lf.eq(PmAuditDeptRef::getDeptId, sysDept.getParentId()); lf.eq(PmAuditDeptRef::getRefType, "2"); listf = pmAuditDeptRefService.list(lf); //上级参与审核的项目id refListf = listf.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toList()); } //取集合差集,只处理差集中的数据 if (!ObjectUtils.isEmpty(refListf)) { refList.removeAll(refListf); } //为空就返回空 if (ObjectUtils.isEmpty(refList) && !SysUser.isAdmin(SecurityUtils.getUserId())) { lw.in(PmDemand::getDemandId, -1); } else if (!ObjectUtils.isEmpty(refList) && !SysUser.isAdmin(SecurityUtils.getUserId())) { lw.in(PmDemand::getDemandId, refList); } } } else { lw.eq(PmDemand::getCreateBy, SecurityUtils.getUserId()); //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 )"); } else if (reqType == 2) { //任务下达列表 lw.apply("(project_status >=8 )"); } else if (reqType == 3) { //采购执行列表 lw.apply("(project_status >=9 )"); } else if (reqType == 4) { //合同信息列表 lw.apply("(project_status >=19 )"); } else if (reqType == 5) { //项目建设列表 lw.apply("(project_status >=20 )"); } lw.last(" order by project_status, plan_demand_sub_time"); IPage pageRes = this.page(new Page<>(pmDemandReqVo.getPageNum(), pmDemandReqVo.getPageSize()), lw); IPage results = new Page<>(pageRes.getCurrent(), pageRes.getSize(), pageRes.getTotal()); if (pageRes.getRecords() != null && pageRes.getRecords().size() > 0) { List pmDemandResVos = demandChangeTo(pageRes.getRecords()); for (PmDemandResVo vo : pmDemandResVos) { if (Arrays.asList(1, 2).contains(reqType)) { // 根据项目id 和 部门id 和 参数类型 获取 部门级别 List 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 ll = new LambdaQueryWrapper<>(); ll.eq(PmAuditDeptRef::getRefId, vo.getDemandId()); ll.eq(PmAuditDeptRef::getRefType, "2"); List listl = pmAuditDeptRefService.list(l); // 判断当前用户是否有审核权限 boolean flay = true; List 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); } } LambdaQueryWrapper pmExpertFeedbackLambdaQueryWrapper = new LambdaQueryWrapper<>(); pmExpertFeedbackLambdaQueryWrapper.eq(PmExpertFeedback::getDemandId, vo.getDemandId()); PmExpertFeedback pmExpertFeedback = this.pmExpertFeedbackService.getOne(pmExpertFeedbackLambdaQueryWrapper); if (pmExpertFeedback != null) { vo.setProjectNumber(pmExpertFeedback.getProjectNumber()); vo.setDocumentReviewTime(pmExpertFeedback.getDocumentReviewTime()); } LambdaQueryWrapper pmProcurementDocumentsReviewLambdaQueryWrapper = new LambdaQueryWrapper<>(); pmProcurementDocumentsReviewLambdaQueryWrapper.eq(PmProcurementDocumentsReview::getDemandId, vo.getDemandId()); PmProcurementDocumentsReview pmProcurementDocumentsReview = this.pmProcurementDocumentsReviewService.getOne(pmProcurementDocumentsReviewLambdaQueryWrapper); if (pmProcurementDocumentsReview != null) { vo.setProcurementOfficeApprovalTime(pmProcurementDocumentsReview.getProcurementOfficeApprovalTime()); } if (Integer.parseInt(vo.getProjectStatus()) > 12 && Integer.parseInt(vo.getProjectStatus()) != 18) { LambdaQueryWrapper pmReleaseAnnouncementLambdaQueryWrapper = new LambdaQueryWrapper<>(); pmReleaseAnnouncementLambdaQueryWrapper.eq(PmReleaseAnnouncement::getDemandId, vo.getDemandId()) .orderByDesc(PmReleaseAnnouncement::getReleaseTime) .last(" limit 1"); PmReleaseAnnouncement pmReleaseAnnouncement = this.pmReleaseAnnouncementService.getOne(pmReleaseAnnouncementLambdaQueryWrapper); if (pmReleaseAnnouncement != null) { vo.setAnnouncementReleaseTime(pmReleaseAnnouncement.getReleaseTime()); vo.setTenderOpenTime(pmReleaseAnnouncement.getTenderOpenTime()); } } if (Integer.parseInt(vo.getProjectStatus()) > 15 && Integer.parseInt(vo.getProjectStatus()) != 16 && Integer.parseInt(vo.getProjectStatus()) != 18) { LambdaQueryWrapper pmBidWinningLambdaQueryWrapper = new LambdaQueryWrapper<>(); pmBidWinningLambdaQueryWrapper.eq(PmBidWinning::getDemandId, vo.getDemandId()).eq(PmBidWinning::getStatus, BidWinningStatus.NORMAL.getCode()) .orderByDesc(PmBidWinning::getBidAnnouncementTime) .last(" limit 1"); PmBidWinning pmBidWinning = this.pmBidWinningService.getOne(pmBidWinningLambdaQueryWrapper); if (pmBidWinning != null) { vo.setBidAnnouncementTime(pmBidWinning.getBidAnnouncementTime()); } } } results.setRecords(pmDemandResVos); } return results; } /** * 查询采购需求列表 * * @param pmDemandReqVo * @return 采购需求 */ @Override public List selectPmDemandListDe(PmDemandReqVo pmDemandReqVo) { LambdaQueryWrapper lw = new LambdaQueryWrapper<>(); List list = new ArrayList<>(); LambdaQueryWrapper l = new LambdaQueryWrapper<>(); l.eq(PmAuditDeptRef::getDeptId, SecurityUtils.getDeptId()); l.eq(PmAuditDeptRef::getRefType, "2"); list = pmAuditDeptRefService.list(l); if (!pmDemandReqVo.getIsAdmin()) { lw.eq(PmDemand::getCreateBy, SecurityUtils.getUserId()); } 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() + "' )"); } lw.last(" order by project_status, plan_demand_sub_time"); List demandList = pmDemandMapper.selectList(lw); List pmDemandResVosTwo = new LinkedList<>(); if (!ObjectUtils.isEmpty(demandList)) { List pmDemandResVos = demandChangeTo(demandList); for (PmDemandResVo vo : pmDemandResVos) { // 根据项目id 和 部门id 和 参数类型 获取 部门级别 List 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 ll = new LambdaQueryWrapper<>(); ll.eq(PmAuditDeptRef::getRefId, vo.getDemandId()); ll.eq(PmAuditDeptRef::getRefType, "2"); List listl = pmAuditDeptRefService.list(l); // 判断当前用户是否有审核权限 boolean flay = true; List 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); if (flay == true || vo.getPurchaseDeptId().equals(SecurityUtils.getDeptId())) { LambdaQueryWrapper pmExpertFeedbackLambdaQueryWrapper = new LambdaQueryWrapper<>(); pmExpertFeedbackLambdaQueryWrapper.eq(PmExpertFeedback::getDemandId, vo.getDemandId()); PmExpertFeedback pmExpertFeedback = this.pmExpertFeedbackService.getOne(pmExpertFeedbackLambdaQueryWrapper); if (pmExpertFeedback != null) { vo.setProjectNumber(pmExpertFeedback.getProjectNumber()); vo.setDocumentReviewTime(pmExpertFeedback.getDocumentReviewTime()); } LambdaQueryWrapper pmProcurementDocumentsReviewLambdaQueryWrapper = new LambdaQueryWrapper<>(); pmProcurementDocumentsReviewLambdaQueryWrapper.eq(PmProcurementDocumentsReview::getDemandId, vo.getDemandId()); PmProcurementDocumentsReview pmProcurementDocumentsReview = this.pmProcurementDocumentsReviewService.getOne(pmProcurementDocumentsReviewLambdaQueryWrapper); if (pmProcurementDocumentsReview != null) { vo.setProcurementOfficeApprovalTime(pmProcurementDocumentsReview.getProcurementOfficeApprovalTime()); } if (Integer.parseInt(vo.getProjectStatus()) > 12 && Integer.parseInt(vo.getProjectStatus()) != 18) { LambdaQueryWrapper pmReleaseAnnouncementLambdaQueryWrapper = new LambdaQueryWrapper<>(); pmReleaseAnnouncementLambdaQueryWrapper.eq(PmReleaseAnnouncement::getDemandId, vo.getDemandId()) .orderByDesc(PmReleaseAnnouncement::getReleaseTime) .last(" limit 1"); PmReleaseAnnouncement pmReleaseAnnouncement = this.pmReleaseAnnouncementService.getOne(pmReleaseAnnouncementLambdaQueryWrapper); if (pmReleaseAnnouncement != null) { vo.setAnnouncementReleaseTime(pmReleaseAnnouncement.getReleaseTime()); vo.setTenderOpenTime(pmReleaseAnnouncement.getTenderOpenTime()); } } if (Integer.parseInt(vo.getProjectStatus()) > 15 && Integer.parseInt(vo.getProjectStatus()) != 16 && Integer.parseInt(vo.getProjectStatus()) != 18) { LambdaQueryWrapper pmBidWinningLambdaQueryWrapper = new LambdaQueryWrapper<>(); pmBidWinningLambdaQueryWrapper.eq(PmBidWinning::getDemandId, vo.getDemandId()).eq(PmBidWinning::getStatus, BidWinningStatus.NORMAL.getCode()) .orderByDesc(PmBidWinning::getBidAnnouncementTime) .last(" limit 1"); PmBidWinning pmBidWinning = this.pmBidWinningService.getOne(pmBidWinningLambdaQueryWrapper); if (pmBidWinning != null) { vo.setBidAnnouncementTime(pmBidWinning.getBidAnnouncementTime()); } } pmDemandResVosTwo.add(vo); } } } } return pmDemandResVosTwo; } /** * 需求建档 * * @param vo 采购需求 * @return 结果 */ @Override @Transactional(rollbackFor = Exception.class) public boolean bookBuilding(PmBookBuildingReqVo vo) throws Exception { PmDemand pmDemand = this.getById(vo.getDemandId()); LambdaQueryWrapper 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 sysFileRefs = vo.getSysFileRefs(); uploadFile(pmBookBuilding.getId(), SysFileRefEnum.PM_BOOK_BUILDING.getType(), sysFileRefs, vo.getUpdateBy()); PmDemand pmDemandUpdate = new PmDemand(); pmDemandUpdate.setDemandId(pmDemand.getDemandId()); pmDemandUpdate.setProjectStatus(PmProjectStatus.DEMAND_WAIT_COMMIT.getCode()); pmDemandUpdate.setEvaluation(vo.getBudgetAmount()); pmDemandUpdate.setProjectType(vo.getProjectType()); pmDemandUpdate.setPurchaseMode(vo.getPurchaseMode()); pmDemandUpdate.setUpdateBy(vo.getUpdateBy()); pmDemandUpdate.setUpdateTime(DateUtils.getNowDate()); return this.updateById(pmDemandUpdate); } else { return false; } } private List getSysFileInfoList(Long redId, Integer type) { HashMap map = new HashMap<>(); map.put("red_id", redId); map.put("type", type); List fileRefs = sysFileRefService.listByMap(map); if (!ObjectUtils.isEmpty(fileRefs)) { List fileInfos = new ArrayList<>(); for (SysFileRef ref : fileRefs) { SysFileInfo fileInfo = fileService.getById(ref.getFileId()); fileInfos.add(fileInfo); } return fileInfos; } else { return null; } } /** * 提交采购需求 * * @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(); 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()); List data = iSysDictTypeService.selectDictDataByType("alert_time_setting"); int setting2 = Integer.parseInt(data.stream().filter(item -> item.getDictLabel().equals("计划完成时间")).collect(Collectors.toList()).get(0).getDictValue()); log.info("******** setting2 == " + setting2); //采购完成时间:根据数据阈值中设置的采购完成时间进行判断,进行预警 int diff2 = DateUtils.differentDaysByMillisecond(pmDemand.getPlanPurchaseFinishTime(), DateUtils.parseDate(DateUtils.getDate())); if (ObjectUtils.isEmpty(pmDemand.getRealPurchaseFinishTime()) && diff2 > 0 && diff2 <= setting2) { log.info("******** 采购完成预警: " + pmDemand.getProjectName()); pmDemandUpdate.setWarnStatus(WarnStatus.PURCHASE_FINISH_WARNING.getCode()); } else if (ObjectUtils.isEmpty(pmDemand.getRealPurchaseFinishTime()) && pmDemand.getPlanPurchaseFinishTime().getTime() < System.currentTimeMillis()) { log.info("******** 采购完成逾期: " + pmDemand.getProjectName()); pmDemandUpdate.setWarnStatus(WarnStatus.PURCHASE_FINISH_EX.getCode()); this.updateById(pmDemandUpdate); } else { pmDemandUpdate.setWarnStatus(WarnStatus.NORMAL.getCode()); } return this.updateById(pmDemandUpdate); } /** * 查看流程图 * * @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) || PmProjectStatus.WASTE_BID_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.PURCHASE_DEMAND_DOCKING.getCode().equals(projectStatus)) { moduleName = "选取代理"; } else if (PmProjectStatus.EXPERT_FEEDBACK.getCode().equals(projectStatus)) { moduleName = "上传意见反馈单"; } else if (PmProjectStatus.PROCUREMENT_DOCUMENTS_REVIEW.getCode().equals(projectStatus)) { moduleName = "上传招标文件审批表"; } else if (PmProjectStatus.PROCUREMENT_ANNOUNCEMENT.getCode().equals(projectStatus)) { moduleName = "采购公告发布"; } else if (PmProjectStatus.PRE_BID_QUERY.getCode().equals(projectStatus)) { moduleName = "标前质疑投诉"; } else if (PmProjectStatus.WAIT_OPEN_BID.getCode().equals(projectStatus)) { moduleName = "填写专家信息,开评标"; } else if (PmProjectStatus.BID_RESULT_ANNOUNCEMENT.getCode().equals(projectStatus) || PmProjectStatus.WASTE_BID_HANDLE.getCode().equals(projectStatus)) { moduleName = "评标结果公告"; } else if (PmProjectStatus.POST_BID_QUERY.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; } /** * 审核采购需求通过 * * @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 lw = new LambdaQueryWrapper(); lw.eq(PmAuditDeptRef::getRefId, pmDemandReqVo.getDemandId()); lw.eq(PmAuditDeptRef::getRefType, "2"); List 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 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 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 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.setTaskReleaseTime(pmDemandReqVo.getTaskReleaseTime()); pmDemand.setProjectStatus(PmProjectStatus.PURCHASE_DEMAND_DOCKING.getCode()); List 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 sysFileRefs, String upateBy, boolean delOld) { if (!ObjectUtils.isEmpty(sysFileRefs)) { // 删关联 LambdaQueryWrapper lw = new LambdaQueryWrapper<>(); lw.eq(SysFileRef::getRedId, redId); lw.eq(SysFileRef::getType, fileType); sysFileRefMapper.delete(lw); //添加新的 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 uploadFile(Long redId, Integer fileType, List sysFileRefs, String upateBy) { return uploadFile(redId, fileType, sysFileRefs, upateBy, 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.PRE_BID_QUERY.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 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 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() + ")所属采购品种和项目类型不匹配"); } else { baseExpert.setVarietyPurchase(pmDemand.getProjectType()); } 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 (ObjectUtils.isEmpty(baseExpert.getId())) { LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.eq(BaseExpert::getIdNumber, baseExpert.getIdNumber()); BaseExpert baseExpert1 = baseExpertService.getOne(lambdaQueryWrapper); if (!ObjectUtils.isEmpty(baseExpert1)) { baseExpert.setId(baseExpert1.getId()); } } if (baseExpertService.saveOrUpdate(baseExpert)) { LambdaQueryWrapper 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 baseUnitInformationList = baseExpertMapper.selectByUnitInformation(baseExpert.getUnitInformation()); if (baseUnitInformationList.size() <= 0) { BaseUnitInformation baseUnitInformation = new BaseUnitInformation(); baseUnitInformation.setUnitName(baseExpert.getUnitInformation()); baseUnitInformation.setVarietyPurchase(baseExpert.getVarietyPurchase()); 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 needAvoidUnitList = null; if (!ObjectUtils.isEmpty(needAvoidUnit)) { String[] arr = needAvoidUnit.split(","); needAvoidUnitList = Arrays.asList(arr); } List sysRegionCodeList = new ArrayList<>(); if (!ObjectUtils.isEmpty(localArea)) { sysRegionCodeList.add(localArea); //找到该地域code对应的子列表 List sysRegionVOList = iSysRegionService.findChildDivisions(localArea); if (!ObjectUtils.isEmpty(sysRegionVOList)) { for (SysRegionVO vo : sysRegionVOList) { sysRegionCodeList.add(vo.getCode()); } } } //从专家库中查询符合项目类型的以及是白名单的全部列表 LambdaQueryWrapper 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 baseExpertList = baseExpertService.list(lw); if (ObjectUtils.isEmpty(baseExpertList)) { throw new Exception("没抽取到符合条件的专家"); } //从列表中挑出来各个类型的子列表 List technicalExpertList = new ArrayList<>(); List economicExpertList = new ArrayList<>(); List legalAffairsExpertList = new ArrayList<>(); List spareExpertList = new ArrayList<>(); String[] arr = professional.split(","); List professionalList = Arrays.asList(arr); for (BaseExpert baseExpert : baseExpertList) { //专业类型判断 String majorType = baseExpert.getMajorType(); if (!ObjectUtils.isEmpty(majorType)) { String[] arr2 = majorType.split(","); List 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 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 spareExpertListNew = new ArrayList<>(); if (!ObjectUtils.isEmpty(spareExpertList)) { //获取全部IDlist List 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 pmDemandExpertRefList = new ArrayList<>(); for (BaseExpert baseExpert : alltExpertList) { LambdaQueryWrapper 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 professionalList, List 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 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 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.BID_RESULT_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 pmBidOpeningIdList = pmBidWinningReqVo.getPmBidOpeningIdList(); if (ObjectUtils.isEmpty(pmBidWinningReqVo.getBidWinningAmount()) && ObjectUtils.isEmpty(pmBidWinningReqVo.getRemarks())) { 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 pmBidWinningLambdaQueryWrapper = new LambdaQueryWrapper<>(); pmBidWinningLambdaQueryWrapper.eq(PmBidWinning::getDemandId, pmBidWinningReqVo.getDemandId()) .eq(PmBidWinning::getStatus, BidWinningStatus.NORMAL.getCode()); List pmBidWinninglist = pmBidWinningService.list(pmBidWinningLambdaQueryWrapper); if (!ObjectUtils.isEmpty(pmBidWinninglist)) { for (PmBidWinning item : pmBidWinninglist) { UpdateWrapper updateWrapper1 = new UpdateWrapper<>(); updateWrapper1.lambda().set(PmBidWinning::getStatus, BidWinningStatus.BE_REPLACED.getCode()) .eq(PmBidWinning::getId, item.getId()); pmBidWinningService.update(updateWrapper1); UpdateWrapper 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 pmBidWinningOpeningRefList = new ArrayList<>(); for (Long pmBidOpeningId : pmBidOpeningIdList) { LambdaQueryWrapper 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.setDemandId(pmBidWinning.getDemandId()); 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 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.POST_BID_QUERY.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 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 lw = new LambdaQueryWrapper<>(); lw.eq(PmBidWinning::getDemandId, pmBidWinningReqVo.getDemandId()).eq(PmBidWinning::getStatus, BidWinningStatus.NORMAL.getCode()); List pmBidWinninglist = pmBidWinningService.list(lw); if (ObjectUtils.isEmpty(pmBidWinninglist)) { throw new Exception("原中标信息不存在"); } //修改老的状态 for (PmBidWinning item : pmBidWinninglist) { UpdateWrapper updateWrapper1 = new UpdateWrapper<>(); updateWrapper1.lambda().set(PmBidWinning::getStatus, BidWinningStatus.BE_REPLACED.getCode()) .eq(PmBidWinning::getId, item.getId()); pmBidWinningService.update(updateWrapper1); UpdateWrapper 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 pmBidWinningOpeningRefList = new ArrayList<>(); for (Long pmBidOpeningId : pmBidOpeningIdList) { PmBidWinningOpeningRef pmBidWinningOpeningRef = new PmBidWinningOpeningRef(); pmBidWinningOpeningRef.setDemandId(pmBidWinning.getDemandId()); 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 sysFileRefLambdaQueryWrapper = new LambdaQueryWrapper<>(); sysFileRefLambdaQueryWrapper.eq(SysFileRef::getType, SysFileRefEnum.PM_BID_WINNING_FILE.getType()) .eq(SysFileRef::getRedId, pmBidWinninglist.get(0)); List 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 lw = new LambdaQueryWrapper<>(); lw.eq(PmBidWinning::getDemandId, pmBidFailureReqVo.getDemandId()).eq(PmBidWinning::getStatus, BidWinningStatus.NORMAL.getCode()); List pmBidWinninglist = pmBidWinningService.list(lw); if (!ObjectUtils.isEmpty(pmBidWinninglist)) { for (PmBidWinning item : pmBidWinninglist) { UpdateWrapper updateWrapper1 = new UpdateWrapper<>(); updateWrapper1.lambda().set(PmBidWinning::getStatus, BidWinningStatus.BE_BID_FAILURE.getCode()) .eq(PmBidWinning::getId, item.getId()); pmBidWinningService.update(updateWrapper1); UpdateWrapper 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 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.WASTE_BID_HANDLE.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 sysFileRefs = pmContractInfoReqVo.getSysFileRefs(); if (ObjectUtils.isEmpty(sysFileRefs)) { throw new Exception("上传附件不能为空"); } LambdaQueryWrapper 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 sysFileRefs = pmProjectConstructionReqVo.getSysFileRefs(); if (ObjectUtils.isEmpty(sysFileRefs)) { throw new Exception("上传附件不能为空"); } LambdaQueryWrapper 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.setWarnStatus(WarnStatus.NORMAL.getCode()); 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 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 > 0 && diff1 <= setting1) { PmDemand pmDemandUpdate = new PmDemand(); pmDemandUpdate.setDemandId(demnadId); pmDemandUpdate.setWarnStatus(WarnStatus.DEMAND_COMMT_WARNING.getCode()); this.updateById(pmDemandUpdate); } else if (ObjectUtils.isEmpty(pmDemand.getRealDemandCommitTime()) && pmDemand.getPlanDemandSubTime().getTime() < System.currentTimeMillis()) { PmDemand pmDemandUpdate = new PmDemand(); pmDemandUpdate.setDemandId(demnadId); pmDemandUpdate.setWarnStatus(WarnStatus.DEMAND_COMMT_EX.getCode()); this.updateById(pmDemandUpdate); } } /** * 通过需求ID列表 查询采购执行列表 sunhh * * @param demandIdList * @return */ @Override public List selectByDemandIdList(List demandIdList) { return this.baseMapper.selectByDemandIdList(demandIdList); } /** * 专家库--查询抽取专家列表 非必传条件:专家名称,开始结束时间 sunhh * * @param baseExpertVo * @return */ @Override public List selectExtractionExpert(BaseExpertVo baseExpertVo) { return pmDemandMapper.selectExtractionExpert(baseExpertVo); } @Override public List demandWaitCommit() { List byStatus = getListByStatus(PmProjectStatus.DEMAND_WAIT_FILL.getCode()); byStatus.addAll(getListByStatus(PmProjectStatus.DEMAND_WAIT_COMMIT.getCode())); return (byStatus); } @Override public List contractWaitFilled() { List byStatus = getListByStatus(PmProjectStatus.CONTRACT_WAIT_FILL.getCode()); return (byStatus); } @Override public List projectWaitFinish() { List byStatus = getListByStatus(PmProjectStatus.UNDER_CONSTRUCTION.getCode()); return (byStatus); } @Override public List demandWaitExamine() { return getListByStatus(PmProjectStatus.DEMAND_WAIT_AUDIT.getCode()); } @Override public List taskWaitRelease() { return getListByStatus(PmProjectStatus.TASK_WAIT_RELEASE.getCode()); } @Override public List purchaseDemandDocking() { List byStatus = getListByStatusCGB(PmProjectStatus.PURCHASE_DEMAND_DOCKING.getCode()); return listToVoList(byStatus); } @Override public List expertFeedback() { List byStatus = getListByStatusCGB(PmProjectStatus.EXPERT_FEEDBACK.getCode()); return listToVoList(byStatus); } @Override public List procurementDocumentsReview() { List byStatus = getListByStatusCGB(PmProjectStatus.PROCUREMENT_DOCUMENTS_REVIEW.getCode()); return listToVoList(byStatus); } @Override public List procurementAnnouncement() { List byStatus = getListByStatusCGB(PmProjectStatus.PROCUREMENT_ANNOUNCEMENT.getCode()); return listToVoList(byStatus); } @Override public List preBidQuery() { List byStatus = getListByStatusCGB(PmProjectStatus.PRE_BID_QUERY.getCode()); return listToVoList(byStatus); } @Override public List waitOpenBid() { List byStatus = getListByStatusCGB(PmProjectStatus.WAIT_OPEN_BID.getCode()); return listToVoList(byStatus); } @Override public List bidResultAnnouncement() { List byStatus = getListByStatusCGB(PmProjectStatus.BID_RESULT_ANNOUNCEMENT.getCode()); return listToVoList(byStatus); } @Override public List wasteBidHandle() { List byStatus = getListByStatusCGB(PmProjectStatus.WASTE_BID_HANDLE.getCode()); return listToVoList(byStatus); } @Override public List postBidQuery() { List byStatus = getListByStatusCGB(PmProjectStatus.POST_BID_QUERY.getCode()); return listToVoList(byStatus); } @Override public AjaxResult procurementOfficeWillManipulateTotal() { List homeRes = new ArrayList<>(); // 采购需求对接,专家意见反馈,采购文件编制审核,采购公告发布,标前质疑投诉,待开标,评标结果公告,流废标处置,标后质疑 List demandRes = new ArrayList<>(); List projectStatus = new ArrayList<>(); projectStatus.add(PmProjectStatus.PURCHASE_DEMAND_DOCKING.getCode()); projectStatus.add(PmProjectStatus.EXPERT_FEEDBACK.getCode()); projectStatus.add(PmProjectStatus.PROCUREMENT_DOCUMENTS_REVIEW.getCode()); projectStatus.add(PmProjectStatus.PROCUREMENT_ANNOUNCEMENT.getCode()); projectStatus.add(PmProjectStatus.PRE_BID_QUERY.getCode()); projectStatus.add(PmProjectStatus.WAIT_OPEN_BID.getCode()); projectStatus.add(PmProjectStatus.BID_RESULT_ANNOUNCEMENT.getCode()); projectStatus.add(PmProjectStatus.WASTE_BID_HANDLE.getCode()); projectStatus.add(PmProjectStatus.POST_BID_QUERY.getCode()); demandRes = listToVoList(getListByStatusTotalCGB(projectStatus)); //计划数据--发函催告 List 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); } @Override public AjaxResult procurementOfficeWillManipulateTotalNum() { List result = new ArrayList<>(); // 采购需求对接,专家意见反馈,采购文件编制审核,采购公告发布,标前质疑投诉,待开标,评标结果公告,流废标处置,标后质疑 Integer numByStatus = getNumByStatusCGB(PmProjectStatus.PURCHASE_DEMAND_DOCKING.getCode()); StatisticalChartsResVo chartsResVo = new StatisticalChartsResVo(); chartsResVo.setNum(numByStatus); chartsResVo.setColumnName("采购需求对接"); result.add(chartsResVo); Integer numByStatus1 = getNumByStatusCGB(PmProjectStatus.EXPERT_FEEDBACK.getCode()); StatisticalChartsResVo chartsResVo1 = new StatisticalChartsResVo(); chartsResVo1.setColumnName("专家意见反馈"); chartsResVo1.setNum(numByStatus1); result.add(chartsResVo1); Integer numByStatus2 = getNumByStatusCGB(PmProjectStatus.PROCUREMENT_DOCUMENTS_REVIEW.getCode()); StatisticalChartsResVo chartsResVo2 = new StatisticalChartsResVo(); chartsResVo2.setColumnName("采购文件编制审核"); chartsResVo2.setNum(numByStatus2); result.add(chartsResVo2); Integer numByStatus3 = getNumByStatusCGB(PmProjectStatus.PROCUREMENT_ANNOUNCEMENT.getCode()); StatisticalChartsResVo chartsResVo3 = new StatisticalChartsResVo(); chartsResVo3.setColumnName("采购公告发布"); chartsResVo3.setNum(numByStatus3); result.add(chartsResVo3); Integer numByStatus4 = getNumByStatusCGB(PmProjectStatus.PRE_BID_QUERY.getCode()); StatisticalChartsResVo chartsResVo4 = new StatisticalChartsResVo(); chartsResVo4.setColumnName("标前质疑投诉"); chartsResVo4.setNum(numByStatus4); result.add(chartsResVo4); Integer numByStatus5 = getNumByStatusCGB(PmProjectStatus.WAIT_OPEN_BID.getCode()); StatisticalChartsResVo chartsResVo5 = new StatisticalChartsResVo(); chartsResVo5.setColumnName("待开标"); chartsResVo5.setNum(numByStatus5); result.add(chartsResVo5); Integer numByStatus6 = getNumByStatusCGB(PmProjectStatus.BID_RESULT_ANNOUNCEMENT.getCode()); StatisticalChartsResVo chartsResVo6 = new StatisticalChartsResVo(); chartsResVo6.setColumnName("评标结果公告"); chartsResVo6.setNum(numByStatus6); result.add(chartsResVo6); Integer numByStatus7 = getNumByStatusCGB(PmProjectStatus.WASTE_BID_HANDLE.getCode()); StatisticalChartsResVo chartsResVo7 = new StatisticalChartsResVo(); chartsResVo7.setColumnName("流废标处置"); chartsResVo7.setNum(numByStatus7); result.add(chartsResVo7); Integer numByStatus8 = getNumByStatusCGB(PmProjectStatus.POST_BID_QUERY.getCode()); StatisticalChartsResVo chartsResVo8 = new StatisticalChartsResVo(); chartsResVo8.setColumnName("标后质疑"); chartsResVo8.setNum(numByStatus8); result.add(chartsResVo8); //计划数据--发函催告 Integer letterNum = planYearsService.willSendLetterNum(); StatisticalChartsResVo chartsResVo9 = new StatisticalChartsResVo(); chartsResVo9.setColumnName("发函催告"); chartsResVo9.setNum(letterNum); result.add(chartsResVo9); StatisticalChartsResVo chartsResVoT = new StatisticalChartsResVo(); chartsResVoT.setColumnName("全部"); chartsResVoT.setNum(willTotal(result)); result.add(chartsResVoT); return AjaxResult.success(result); } public Integer willTotal(List result) { Integer re = 0; if (!ObjectUtils.isEmpty(result)) { for (StatisticalChartsResVo resVo : result) { re += resVo.getNum(); } } return re; } /** * 统计分析-采购项目信息统计 * * @param pmDemandReqVo * @return */ @Override public Map purchaseProjectStatistical(PmDemandReqVo pmDemandReqVo) { //是-1就是查询自己及子孙级以下,否则只查询指定部门 pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId())); Map mapReturn = new HashMap<>(); // 查询项目总数量 Map mapCount = pmDemandMapper.purchaseProjectStatistical(pmDemandReqVo); // 查询已完成项目数量,预算(合同)金额数量 Map mapYWC = pmDemandMapper.purchaseProjectStatisticalYWC(pmDemandReqVo); // 查询新创建项目数量,预算金额数量 Map mapXCJ = pmDemandMapper.purchaseProjectStatisticalXCJ(pmDemandReqVo); // 查询去年完成项目数量,预算(合同)金额数量 Map mapQNWC = pmDemandMapper.purchaseProjectStatisticalQNWC(pmDemandReqVo); mapReturn.putAll(mapCount); mapReturn.putAll(mapYWC); mapReturn.putAll(mapXCJ); mapReturn.putAll(mapQNWC); return mapReturn; } @Override public List countByProjectAttr(PmDemandReqVo pmDemandReqVo) { //是-1就是查询自己及子孙级以下,否则只查询指定部门 if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) { pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId())); } else { pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId())); } List resVos = new ArrayList<>(); //直接获取每个属性的数量 //重点采购项目 pmDemandReqVo.setProjectAttr(ProjectAttribute.emergency.getCode()); StatisticalChartsResVo vo1 = pmDemandMapper.countByProjectAttr(pmDemandReqVo); vo1.setColumnName("重点采购项目"); resVos.add(vo1); //重大规划任务项目 pmDemandReqVo.setProjectAttr(ProjectAttribute.majorPlan.getCode()); StatisticalChartsResVo vo2 = pmDemandMapper.countByProjectAttr(pmDemandReqVo); vo2.setColumnName("重大规划任务项目"); resVos.add(vo2); //规划任务项目 pmDemandReqVo.setProjectAttr(ProjectAttribute.plan.getCode()); StatisticalChartsResVo vo3 = pmDemandMapper.countByProjectAttr(pmDemandReqVo); vo3.setColumnName("规划任务项目"); resVos.add(vo3); //一般采购项目 pmDemandReqVo.setProjectAttr(ProjectAttribute.commonly.getCode()); StatisticalChartsResVo vo4 = pmDemandMapper.countByProjectAttr(pmDemandReqVo); vo4.setColumnName("一般采购项目"); resVos.add(vo4); return resVos; } @Override public List countByTaskAttr(PmDemandReqVo pmDemandReqVo) { //是-1就是查询自己及子孙级以下,否则只查询指定部门 if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) { pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId())); } else { pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId())); } //状态为“任务待下达”以后的数据 pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.TASK_WAIT_RELEASE.getCode())); List resVos = new ArrayList<>(); //重点采购项目 pmDemandReqVo.setProjectAttr(ProjectAttribute.emergency.getCode()); StatisticalChartsResVo vo1 = pmDemandMapper.countByTaskAttr(pmDemandReqVo); vo1.setColumnName("重点采购项目"); resVos.add(vo1); //重大规划任务项目 pmDemandReqVo.setProjectAttr(ProjectAttribute.majorPlan.getCode()); StatisticalChartsResVo vo2 = pmDemandMapper.countByTaskAttr(pmDemandReqVo); vo2.setColumnName("重大规划任务项目"); resVos.add(vo2); //规划任务项目 pmDemandReqVo.setProjectAttr(ProjectAttribute.plan.getCode()); StatisticalChartsResVo vo3 = pmDemandMapper.countByTaskAttr(pmDemandReqVo); vo3.setColumnName("规划任务项目"); resVos.add(vo3); //一般采购项目 pmDemandReqVo.setProjectAttr(ProjectAttribute.commonly.getCode()); StatisticalChartsResVo vo4 = pmDemandMapper.countByTaskAttr(pmDemandReqVo); vo4.setColumnName("一般采购项目"); resVos.add(vo4); return resVos; } @Override public List countByPurchaseMode(PmDemandReqVo pmDemandReqVo) { //是-1就是查询自己及子孙级以下,否则只查询指定部门 if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) { pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId())); } else { pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId())); } //状态为“任务待下达”以后的数据 pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.TASK_WAIT_RELEASE.getCode())); List resVos = new ArrayList<>(); //公开招标 pmDemandReqVo.setPurchaseMode(ProcurementMethodSuggest.OPEN_BIDDING.getCode()); StatisticalChartsResVo chartsR = pmDemandMapper.countByPurchaseMode(pmDemandReqVo); chartsR.setColumnName("公开招标"); resVos.add(chartsR); //邀请招标 pmDemandReqVo.setPurchaseMode(ProcurementMethodSuggest.SELECTED_BIDDING.getCode()); StatisticalChartsResVo chartsR1 = pmDemandMapper.countByPurchaseMode(pmDemandReqVo); chartsR1.setColumnName("邀请招标"); resVos.add(chartsR1); //竞争性谈判 pmDemandReqVo.setPurchaseMode(ProcurementMethodSuggest.COMPETITIVE_NEGOTIATION.getCode()); StatisticalChartsResVo chartsR2 = pmDemandMapper.countByPurchaseMode(pmDemandReqVo); chartsR2.setColumnName("竞争性谈判"); resVos.add(chartsR2); //询价 pmDemandReqVo.setPurchaseMode(ProcurementMethodSuggest.ENQUIRY.getCode()); StatisticalChartsResVo chartsR3 = pmDemandMapper.countByPurchaseMode(pmDemandReqVo); chartsR3.setColumnName("询价"); resVos.add(chartsR3); //单一来源 pmDemandReqVo.setPurchaseMode(ProcurementMethodSuggest.SINGLE_SOURCE.getCode()); StatisticalChartsResVo chartsR4 = pmDemandMapper.countByPurchaseMode(pmDemandReqVo); chartsR4.setColumnName("单一来源"); resVos.add(chartsR4); return resVos; } @Override public List countByEvaluation(PmDemandReqVo pmDemandReqVo) { //是-1就是查询自己及子孙级以下,否则只查询指定部门 if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) { pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId())); } else { pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId())); } //状态为“任务待下达”以后的数据 pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.TASK_WAIT_RELEASE.getCode())); List 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) { //是-1就是查询自己及子孙级以下,否则只查询指定部门 if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) { pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId())); } else { pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId())); } List resVos = new ArrayList<>(); //执行滞后采购项目:本年度所有的逾期项目数 //预算金额:本年度所有逾期项目累加的预算金额 StatisticalChartsResVo resVo = pmDemandMapper.countProjectExceedThisYear(pmDemandReqVo); resVo.setColumnName("本年度执行滞后任务"); resVo.setColumnNamePlus("任务新增数量"); resVos.add(resVo); StatisticalChartsResVo resVo2 = pmDemandMapper.countProjectExceedThisQua(pmDemandReqVo); resVo2.setColumnName("本季度执行滞后任务"); resVo2.setColumnNamePlus("任务新增数量"); resVos.add(resVo2); StatisticalChartsResVo resVo3 = pmDemandMapper.countProjectExceedThisMonth(pmDemandReqVo); resVo3.setColumnName("本月执行滞后任务"); resVo3.setColumnNamePlus("任务新增数量"); resVos.add(resVo3); StatisticalChartsResVo resVo4 = pmDemandMapper.countProjectExceedAllNum(pmDemandReqVo); resVo4.setColumnName("累计执行滞后采购任务"); resVo4.setColumnNamePlus("采购任务数量"); resVos.add(resVo4); //执行停滞采购任务数量--退回的采购任务数量 List tzrw = new ArrayList<>(); tzrw.add(PmProjectStatus.DEMAND_AUDIT_RETURN.getCode()); pmDemandReqVo.setProjectStatusList(tzrw); Map map = pmDemandMapper.purchaseProjectDistribution(pmDemandReqVo); StatisticalChartsResVo resVo5 = new StatisticalChartsResVo(); resVo5.setColumnName("执行停滞"); resVo5.setColumnNamePlus("采购任务数量"); resVo5.setNum(Math.toIntExact((Long) map.get("countNumber"))); resVo5.setEvaluationTotal((BigDecimal) map.get("evaluationTotal")); resVos.add(resVo5); return AjaxResult.success(resVos); } /** * 统计不同时间维度的逾期项目 * * @return */ @Override public AjaxResult exceedAnalysis(PmDemandReqVo pmDemandReqVo) { //是-1就是查询自己及子孙级以下,否则只查询指定部门 pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId())); HashMap> resMap = new HashMap<>(); List byYear = pmDemandMapper.countProjectExceedYear(pmDemandReqVo); if (pmDemandReqVo.getTimeType().equals("1")) { resMap.put("年", byYear); } else if (pmDemandReqVo.getTimeType().equals("2")) { List 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, BigDecimal.valueOf(0), BigDecimal.valueOf(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 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, BigDecimal.valueOf(0), BigDecimal.valueOf(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) { //是-1就是查询自己及子孙级以下,否则只查询指定部门 pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId())); HashMap> resMap = new HashMap<>(); //任务数量趋势分析:按照月、季度、年统计“项目属性”字段中“重大规划”属性的项目 List byYear = pmDemandMapper.countProjectMajorByYear(pmDemandReqVo); if (pmDemandReqVo.getTimeType().equals("1")) { resMap.put("年", byYear); } else if (pmDemandReqVo.getTimeType().equals("2")) { List 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 byMonth = pmDemandMapper.countProjectMajorByMonth(pmDemandReqVo); resMap.put("月", byMonth); } return AjaxResult.success(resMap); } @Override public AjaxResult countEveryStatusNum(PmDemandReqVo pmDemandReqVo) { //阶段包括:采购需求对接,专家意见反馈,采购文件编制审核,采购公告发布,标前质疑投诉,待开标,评标结果公告,流废标处置,标后质疑 //是-1就是查询自己及子孙级以下,否则只查询指定部门 if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) { pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId())); } else { pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId())); } List everyStatusNum = new ArrayList<>(); //项目进行到各个阶段的数量 pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.PURCHASE_DEMAND_DOCKING.getCode())); StatisticalChartsResVo everyStatusNum9 = pmDemandMapper.countEveryStatusNum(pmDemandReqVo); everyStatusNum9.setColumnName(PmProjectStatus.PURCHASE_DEMAND_DOCKING.getInfo()); everyStatusNum.add(everyStatusNum9); pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.EXPERT_FEEDBACK.getCode())); StatisticalChartsResVo everyStatusNum10 = pmDemandMapper.countEveryStatusNum(pmDemandReqVo); everyStatusNum10.setColumnName(PmProjectStatus.EXPERT_FEEDBACK.getInfo()); everyStatusNum.add(everyStatusNum10); pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.PROCUREMENT_DOCUMENTS_REVIEW.getCode())); StatisticalChartsResVo everyStatusNum11 = pmDemandMapper.countEveryStatusNum(pmDemandReqVo); everyStatusNum11.setColumnName(PmProjectStatus.PROCUREMENT_DOCUMENTS_REVIEW.getInfo()); everyStatusNum.add(everyStatusNum11); pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.PROCUREMENT_ANNOUNCEMENT.getCode())); StatisticalChartsResVo everyStatusNum12 = pmDemandMapper.countEveryStatusNum(pmDemandReqVo); everyStatusNum12.setColumnName(PmProjectStatus.PROCUREMENT_ANNOUNCEMENT.getInfo()); everyStatusNum.add(everyStatusNum12); pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.PRE_BID_QUERY.getCode())); StatisticalChartsResVo everyStatusNum13 = pmDemandMapper.countEveryStatusNum(pmDemandReqVo); everyStatusNum13.setColumnName(PmProjectStatus.PRE_BID_QUERY.getInfo()); everyStatusNum.add(everyStatusNum13); pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.WAIT_OPEN_BID.getCode())); StatisticalChartsResVo everyStatusNum14 = pmDemandMapper.countEveryStatusNum(pmDemandReqVo); everyStatusNum14.setColumnName(PmProjectStatus.WAIT_OPEN_BID.getInfo()); everyStatusNum.add(everyStatusNum14); pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.BID_RESULT_ANNOUNCEMENT.getCode())); StatisticalChartsResVo everyStatusNum15 = pmDemandMapper.countEveryStatusNum(pmDemandReqVo); everyStatusNum15.setColumnName(PmProjectStatus.BID_RESULT_ANNOUNCEMENT.getInfo()); everyStatusNum.add(everyStatusNum15); pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.WASTE_BID_HANDLE.getCode())); StatisticalChartsResVo everyStatusNum16 = pmDemandMapper.countEveryStatusNum(pmDemandReqVo); everyStatusNum16.setColumnName(PmProjectStatus.WASTE_BID_HANDLE.getInfo()); everyStatusNum.add(everyStatusNum16); pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.POST_BID_QUERY.getCode())); StatisticalChartsResVo everyStatusNum17 = pmDemandMapper.countEveryStatusNum(pmDemandReqVo); everyStatusNum17.setColumnName(PmProjectStatus.POST_BID_QUERY.getInfo()); everyStatusNum.add(everyStatusNum17); return AjaxResult.success(everyStatusNum); } @Override public AjaxResult exceedMarketAnalysis(PmDemandReqVo pmDemandReqVo) { //是-1就是查询自己及子孙级以下,否则只查询指定部门 if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) { pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId())); } else { pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId())); } //所有滞后 List demandList = pmDemandMapper.countProjectExceedAll(pmDemandReqVo); Date now = new Date(); //滞后时长包括:滞后1个月以内的采购任务、滞后1至3个月采购任务、滞后3至6个月采购任务、滞后6个月至1年采购任务、滞后1年以上采购任务 HashMap 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 = 0L; if (!ObjectUtils.isEmpty(demand.getRealPurchaseFinishTime()) && demand.getRealPurchaseFinishTime().getTime() - demand.getPlanPurchaseFinishTime().getTime() > 0) { exTime = demand.getRealPurchaseFinishTime().getTime() - demand.getPlanPurchaseFinishTime().getTime(); } else { exTime = now.getTime() - demand.getPlanPurchaseFinishTime().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) { //是-1就是查询自己及子孙级以下,否则只查询指定部门 if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) { pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId())); } else { pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId())); } List resVos = new ArrayList<>(); //本月度新提报重大规划采购任务数量 pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.DEMAND_WAIT_COMMIT.getCode())); StatisticalChartsResVo resVo = pmDemandMapper.majorProjectByStatusThisMonthSub(pmDemandReqVo); resVo.setColumnName("本月度新提报"); resVo.setColumnNamePlus("重大规划采购任务数量"); resVos.add(resVo); //本季度新提报重大规划采购任务数量 pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.DEMAND_WAIT_COMMIT.getCode())); StatisticalChartsResVo resVo2 = pmDemandMapper.majorProjectByStatusThisQuaSub(pmDemandReqVo); resVo2.setColumnName("本季度新提报"); resVo2.setColumnNamePlus("重大规划采购任务数量"); resVos.add(resVo2); //本年度新提报重大规划采购任务数量 pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.DEMAND_WAIT_COMMIT.getCode())); StatisticalChartsResVo resVo3 = pmDemandMapper.majorProjectByStatusThisYearSub(pmDemandReqVo); resVo3.setColumnName("本年度新提报"); resVo3.setColumnNamePlus("重大规划采购任务数量"); resVos.add(resVo3); //本月度完成重大规划采购任务数量 pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.CONTRACT_WAIT_FILL.getCode())); StatisticalChartsResVo resVo4 = pmDemandMapper.majorProjectByStatusThisMonthFi(pmDemandReqVo); resVo4.setColumnName("本月度完成"); resVo4.setColumnNamePlus("重大规划采购任务数量"); resVos.add(resVo4); //本季度完成重大规划采购任务数量 pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.CONTRACT_WAIT_FILL.getCode())); StatisticalChartsResVo resVo5 = pmDemandMapper.majorProjectByStatusThisQuaFi(pmDemandReqVo); resVo5.setColumnName("本季度完成"); resVo5.setColumnNamePlus("重大规划采购任务数量"); resVos.add(resVo5); //本年度完成重大规划采购任务数量 pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.CONTRACT_WAIT_FILL.getCode())); StatisticalChartsResVo resVo6 = pmDemandMapper.majorProjectByStatusThisYearFi(pmDemandReqVo); resVo6.setColumnName("本年度完成"); resVo6.setColumnNamePlus("重大规划采购任务数量"); resVos.add(resVo6); //上年度结转和本年度新提报重大规划采购任务累计项目数量 List yearLastZ = new ArrayList<>(); yearLastZ.add(PmProjectStatus.DEMAND_WAIT_AUDIT.getCode()); yearLastZ.add(PmProjectStatus.DEMAND_AUDIT_RETURN.getCode()); yearLastZ.add(PmProjectStatus.TASK_WAIT_RELEASE.getCode()); yearLastZ.add(PmProjectStatus.PURCHASE_DEMAND_DOCKING.getCode()); yearLastZ.add(PmProjectStatus.EXPERT_FEEDBACK.getCode()); yearLastZ.add(PmProjectStatus.PROCUREMENT_DOCUMENTS_REVIEW.getCode()); yearLastZ.add(PmProjectStatus.PROCUREMENT_ANNOUNCEMENT.getCode()); yearLastZ.add(PmProjectStatus.PRE_BID_QUERY.getCode()); yearLastZ.add(PmProjectStatus.WAIT_OPEN_BID.getCode()); yearLastZ.add(PmProjectStatus.BID_RESULT_ANNOUNCEMENT.getCode()); yearLastZ.add(PmProjectStatus.WASTE_BID_HANDLE.getCode()); yearLastZ.add(PmProjectStatus.POST_BID_QUERY.getCode()); yearLastZ.add(PmProjectStatus.WASTE_BID_RETURN.getCode()); pmDemandReqVo.setProjectStatusList(yearLastZ); StatisticalChartsResVo resVo7 = pmDemandMapper.majorProjectByStatusLastYear(pmDemandReqVo); if (ObjectUtils.isEmpty(resVo7)) { resVo7 = new StatisticalChartsResVo(); resVo7.setNum(0); resVo7.setEvaluationTotal(BigDecimal.ZERO); resVo7.setEvaluationContractTotal(BigDecimal.ZERO); } resVo7.setNum(resVo7.getNum() + resVo3.getNum()); resVo7.setEvaluationTotal(resVo7.getEvaluationTotal().add(resVo3.getEvaluationTotal())); resVo7.setColumnName("上年度结转和本年度新提报"); resVo7.setColumnNamePlus("重大规划采购任务累计数量"); resVos.add(resVo7); //今年以来累计完成数量 pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.CONTRACT_WAIT_FILL.getCode())); StatisticalChartsResVo resVo8 = pmDemandMapper.majorProjectByStatusToThisYear(pmDemandReqVo); resVo8.setColumnName("今年以来累计"); resVo8.setColumnNamePlus("累计完成数量"); resVos.add(resVo8); //正常推进周期内的重大规划采购任务数量 StatisticalChartsResVo resVo9 = pmDemandMapper.majorProjectByStatusWei(pmDemandReqVo); resVo9.setColumnName("正常推进周期内"); resVo9.setColumnNamePlus("重大规划采购任务数量"); resVos.add(resVo9); //执行滞后的重大规划采购任务数量 StatisticalChartsResVo resVo10 = pmDemandMapper.majorProjectByStatusChao(pmDemandReqVo); resVo10.setColumnName("执行滞后"); resVo10.setColumnNamePlus("重大规划采购任务数量"); resVos.add(resVo10); return AjaxResult.success(resVos); } @Override public AjaxResult countMajorProjectCGB(PmDemandReqVo pmDemandReqVo) { //是-1就是查询自己及子孙级以下,否则只查询指定部门 if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) { pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId())); } else { pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId())); } List resVos = new ArrayList<>(); //本月度新受领重大规划采购任务数量 pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.TASK_WAIT_RELEASE.getCode())); StatisticalChartsResVo resVo = pmDemandMapper.majorProjectByStatusThisMonthNew(pmDemandReqVo); resVo.setColumnName("本月度新受领"); resVo.setColumnNamePlus("重大规划采购任务数量"); resVos.add(resVo); //本季度新受领重大规划采购任务数量 pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.TASK_WAIT_RELEASE.getCode())); StatisticalChartsResVo resVo2 = pmDemandMapper.majorProjectByStatusThisQuaNew(pmDemandReqVo); resVo2.setColumnName("本季度新受领"); resVo2.setColumnNamePlus("重大规划采购任务数量"); resVos.add(resVo2); //本年度新受领重大规划采购任务数量 pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.TASK_WAIT_RELEASE.getCode())); StatisticalChartsResVo resVo3 = pmDemandMapper.majorProjectByStatusThisYearNew(pmDemandReqVo); resVo3.setColumnName("本年度新受领"); resVo3.setColumnNamePlus("重大规划采购任务数量"); resVos.add(resVo3); //上年度结转重大规划采购任务累计项目数量 List yearLastZ = new ArrayList<>(); yearLastZ.add(PmProjectStatus.PURCHASE_DEMAND_DOCKING.getCode()); yearLastZ.add(PmProjectStatus.EXPERT_FEEDBACK.getCode()); yearLastZ.add(PmProjectStatus.PROCUREMENT_DOCUMENTS_REVIEW.getCode()); yearLastZ.add(PmProjectStatus.PROCUREMENT_ANNOUNCEMENT.getCode()); yearLastZ.add(PmProjectStatus.PRE_BID_QUERY.getCode()); yearLastZ.add(PmProjectStatus.WAIT_OPEN_BID.getCode()); yearLastZ.add(PmProjectStatus.BID_RESULT_ANNOUNCEMENT.getCode()); yearLastZ.add(PmProjectStatus.WASTE_BID_HANDLE.getCode()); yearLastZ.add(PmProjectStatus.POST_BID_QUERY.getCode()); yearLastZ.add(PmProjectStatus.WASTE_BID_RETURN.getCode()); pmDemandReqVo.setProjectStatusList(yearLastZ); StatisticalChartsResVo resVo7 = pmDemandMapper.majorProjectByStatusLastYear(pmDemandReqVo); if (ObjectUtils.isEmpty(resVo7)) { resVo7 = new StatisticalChartsResVo(); resVo7.setNum(0); resVo7.setEvaluationTotal(BigDecimal.ZERO); resVo7.setEvaluationContractTotal(BigDecimal.ZERO); } resVo7.setColumnName("上年度结转和本年度新提报"); resVo7.setColumnNamePlus("累计项目数量"); //上年度结转和本月度新受领重大规划采购任务累计项目数量预算金额 pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.DEMAND_WAIT_COMMIT.getCode())); StatisticalChartsResVo resVo4 = pmDemandMapper.majorProjectByStatusThisMonthFiCGB(pmDemandReqVo); if (ObjectUtils.isEmpty(resVo4)) { resVo4 = new StatisticalChartsResVo(); resVo4.setNum(0); resVo4.setEvaluationTotal(BigDecimal.ZERO); resVo4.setEvaluationContractTotal(BigDecimal.ZERO); } resVo4.setNum(resVo4.getNum() + resVo7.getNum()); resVo4.setEvaluationTotal(resVo4.getEvaluationTotal().add(resVo7.getEvaluationTotal())); resVo4.setColumnName("上年度结转和本月度新受领"); resVo4.setColumnNamePlus("累计项目数量"); resVos.add(resVo4); //上年度结转和本季度新受领重大规划采购任务累计项目数量预算金额 pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.DEMAND_WAIT_COMMIT.getCode())); StatisticalChartsResVo resVo5 = pmDemandMapper.majorProjectByStatusThisQuaFiCGB(pmDemandReqVo); if (ObjectUtils.isEmpty(resVo5)) { resVo5 = new StatisticalChartsResVo(); resVo5.setNum(0); resVo5.setEvaluationTotal(BigDecimal.ZERO); resVo5.setEvaluationContractTotal(BigDecimal.ZERO); } resVo5.setNum(resVo5.getNum() + resVo7.getNum()); resVo5.setEvaluationTotal(resVo5.getEvaluationTotal().add(resVo7.getEvaluationTotal())); resVo5.setColumnName("上年度结转和本季度新受领"); resVo5.setColumnNamePlus("累计项目数量"); resVos.add(resVo5); //上年度结转和本年度新受领重大规划采购任务累计项目数量预算金额 pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.DEMAND_WAIT_COMMIT.getCode())); StatisticalChartsResVo resVo6 = pmDemandMapper.majorProjectByStatusThisYearFiCGB(pmDemandReqVo); if (ObjectUtils.isEmpty(resVo6)) { resVo6 = new StatisticalChartsResVo(); resVo6.setNum(0); resVo6.setEvaluationTotal(BigDecimal.ZERO); resVo6.setEvaluationContractTotal(BigDecimal.ZERO); } resVo6.setNum(resVo6.getNum() + resVo7.getNum()); resVo6.setEvaluationTotal(resVo6.getEvaluationTotal().add(resVo7.getEvaluationTotal())); resVo6.setColumnName("上年度结转和本年度新受领"); resVo6.setColumnNamePlus("累计项目数量"); resVos.add(resVo6); //本月度完成重大规划采购任务数量 pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.CONTRACT_WAIT_FILL.getCode())); StatisticalChartsResVo resVoA = pmDemandMapper.majorProjectByStatusThisMonthFi(pmDemandReqVo); resVoA.setColumnName("本月度完成"); resVoA.setColumnNamePlus("重大规划采购任务数量"); resVos.add(resVoA); //本季度完成重大规划采购任务数量 pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.CONTRACT_WAIT_FILL.getCode())); StatisticalChartsResVo resVoB = pmDemandMapper.majorProjectByStatusThisQuaFi(pmDemandReqVo); resVoB.setColumnName("本季度完成"); resVoB.setColumnNamePlus("重大规划采购任务数量"); resVos.add(resVoB); //本年度完成重大规划采购任务数量 pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.CONTRACT_WAIT_FILL.getCode())); StatisticalChartsResVo resVoC = pmDemandMapper.majorProjectByStatusThisYearFi(pmDemandReqVo); resVoC.setColumnName("本年度完成"); resVoC.setColumnNamePlus("重大规划采购任务数量"); resVos.add(resVoC); //今年以来累计完成数量 pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.CONTRACT_WAIT_FILL.getCode())); StatisticalChartsResVo resVo8 = pmDemandMapper.majorProjectByStatusToThisYear(pmDemandReqVo); resVo8.setColumnName("今年以来累计"); resVo8.setColumnNamePlus("累计完成数量"); resVos.add(resVo8); //正常推进周期内的重大规划采购任务数量 StatisticalChartsResVo resVo9 = pmDemandMapper.majorProjectByStatusWei(pmDemandReqVo); resVo9.setColumnName("正常推进周期内"); resVo9.setColumnNamePlus("重大规划采购任务数量"); resVos.add(resVo9); //执行滞后的重大规划采购任务数量 StatisticalChartsResVo resVo10 = pmDemandMapper.majorProjectByStatusChao(pmDemandReqVo); resVo10.setColumnName("执行滞后"); resVo10.setColumnNamePlus("重大规划采购任务数量"); resVos.add(resVo10); 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 List purchaseProjectExecute(PmDemandReqVo pmDemandReqVo) { List resVos = new ArrayList<>(); //是-1就是查询自己及子孙级以下,否则只查询指定部门 if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) { pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId())); } else { pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId())); } //累计完成采购任务数量 预算金额(万元) 合同金额(万元) StatisticalChartsResVo tThisYear = pmDemandMapper.selectFInishAll(pmDemandReqVo); tThisYear.setColumnName("累计完成采购任务数量"); resVos.add(tThisYear); // 正常推进项目数量、预算金额 StatisticalChartsResVo mapNormalPropulsion = pmDemandMapper.purchaseProjectExecuteNormalPropulsion(pmDemandReqVo); mapNormalPropulsion.setColumnName("正常推进项目数量"); resVos.add(mapNormalPropulsion); // 未完成采购任务,预算金额 StatisticalChartsResVo mapIncomplete = pmDemandMapper.purchaseProjectExecuteIncomplete(pmDemandReqVo); mapIncomplete.setColumnName("未完成采购任务"); resVos.add(mapIncomplete); return resVos; } /** * 已完成项目数量统计 * * @param pmDemandReqVo * @return */ @Override public List> purchaseProjectCompleteNumber(PmDemandReqVo pmDemandReqVo) { //是-1就是查询自己及子孙级以下,否则只查询指定部门 pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId())); List> 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> listMap = pmDemandMapper.selectpurchaseProjectCompleteNumberYear(pmDemandReqVo); mapReturn.addAll(listMap); for (int i = minYear; i <= year; i++) { boolean isYear = false; for (Map map : listMap) { if (i == Integer.parseInt(String.valueOf(map.get("yy")))) { isYear = true; } } if (!isYear) { Map 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> listMap = pmDemandMapper.selectpurchaseProjectCompleteNumberQuarter(pmDemandReqVo); mapReturn.addAll(listMap); for (int i = 1; i <= 4; i++) { boolean isYear = false; for (Map map : listMap) { if (i == Integer.parseInt(String.valueOf(map.get("yy")))) { isYear = true; } } if (!isYear) { Map 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> listMap = pmDemandMapper.selectpurchaseProjectCompleteNumberMonth(pmDemandReqVo); mapReturn.addAll(listMap); for (int i = 1; i <= 12; i++) { boolean isYear = false; for (Map map : listMap) { if (i == Integer.parseInt(String.valueOf(map.get("yy")))) { isYear = true; } } if (!isYear) { Map 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> purchaseTaskFinish(PmDemandReqVo pmDemandReqVo) { //是-1就是查询自己及子孙级以下,否则只查询指定部门 if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) { pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId())); } else { pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId())); } List> 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> listMap = pmDemandMapper.selectPurchaseTaskFinishYear(pmDemandReqVo); //mapReturn.addAll(listMap); for (int i = minYear; i <= year; i++) { boolean isYear = false; for (Map map : listMap) { if (i == Integer.parseInt(String.valueOf(map.get("yy")))) { isYear = true; map.put("yy", i); mapReturn.add(map); } } if (!isYear) { Map 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> listMap = pmDemandMapper.selectPurchaseTaskFinishQuarter(pmDemandReqVo); //mapReturn.addAll(listMap); for (int i = 1; i <= 4; i++) { boolean isYear = false; for (Map map : listMap) { if (i == Integer.parseInt(String.valueOf(map.get("yy")))) { isYear = true; map.put("yy", i); mapReturn.add(map); } } if (!isYear) { Map 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> listMap = pmDemandMapper.selectPurchaseTaskFinishMonth(pmDemandReqVo); //mapReturn.addAll(listMap); for (int i = 1; i <= 12; i++) { boolean isYear = false; for (Map map : listMap) { if (i == Integer.parseInt(String.valueOf(map.get("yy")))) { isYear = true; map.put("yy", i); map.put("countNum", 0); mapReturn.add(map); } } if (!isYear) { Map 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> purchaseProjectNumberAnalysis(PmDemandReqVo pmDemandReqVo) { //是-1就是查询自己及子孙级以下,否则只查询指定部门 if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) { pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId())); } else { pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId())); } List> 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> listMap = pmDemandMapper.purchaseProjectNumberAnalysisYear(pmDemandReqVo); mapReturn.addAll(listMap); for (int i = minYear; i <= year; i++) { boolean isYear = false; for (Map map : listMap) { if (i == Integer.parseInt(String.valueOf(map.get("yy")))) { isYear = true; } } if (!isYear) { Map 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> listMap = pmDemandMapper.purchaseProjectNumberAnalysisQuarter(pmDemandReqVo); List> mapList = new ArrayList<>(); mapList.addAll(listMap); for (int i = 1; i <= 4; i++) { boolean isYear = false; for (Map map : listMap) { if (i == Integer.parseInt(String.valueOf(map.get("yy")))) { isYear = true; } } if (!isYear) { Map map1 = new HashMap<>(); map1.put("yy", i + ""); map1.put("countNum", 0 + ""); map1.put("evaluationSum", 0 + ""); mapList.add(map1); } } Map map1 = new HashMap<>(); Map map2 = new HashMap<>(); Map map3 = new HashMap<>(); Map map4 = new HashMap<>(); for (Map 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> listMapOldYear = pmDemandMapper.purchaseProjectNumberAnalysisOldYearQuarter(pmDemandReqVo); List> mapListOld = new ArrayList<>(); mapListOld.addAll(listMapOldYear); for (int i = 1; i <= 4; i++) { boolean isYear = false; for (Map map : listMapOldYear) { if (i == Integer.parseInt(String.valueOf(map.get("yy")))) { isYear = true; } } if (!isYear) { Map map11 = new HashMap<>(); map11.put("yy", i + ""); map11.put("countNum", 0 + ""); map11.put("evaluationSum", 0 + ""); mapListOld.add(map11); } } Map mapOld1 = new HashMap<>(); Map mapOld2 = new HashMap<>(); Map mapOld3 = new HashMap<>(); Map mapOld4 = new HashMap<>(); for (Map 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> listMap = pmDemandMapper.purchaseProjectNumberAnalysisMonth(pmDemandReqVo); List> mapList = new ArrayList<>(); mapList.addAll(listMap); for (int i = 1; i <= 12; i++) { boolean isYear = false; for (Map map : listMap) { String yy = String.valueOf(map.get("yy")); String yyNew = yy.replaceAll("^0*", ""); if (i == Integer.valueOf(yyNew)) { isYear = true; } } if (!isYear) { Map 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 map1 = new HashMap<>(); Map map2 = new HashMap<>(); Map map3 = new HashMap<>(); Map map4 = new HashMap<>(); Map map5 = new HashMap<>(); Map map6 = new HashMap<>(); Map map7 = new HashMap<>(); Map map8 = new HashMap<>(); Map map9 = new HashMap<>(); Map map10 = new HashMap<>(); Map map11 = new HashMap<>(); Map map12 = new HashMap<>(); for (Map 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> listMapOldMonth = pmDemandMapper.purchaseProjectNumberAnalysisOldYearMonth(pmDemandReqVo); List> mapListOld = new ArrayList<>(); mapListOld.addAll(listMapOldMonth); for (int i = 1; i <= 12; i++) { boolean isYear = false; for (Map map : listMapOldMonth) { String yy = String.valueOf(map.get("yy")); String yyNew = yy.replaceAll("^0*", ""); if (i == Integer.valueOf(yyNew)) { isYear = true; } } if (!isYear) { Map 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 mapOld1 = new HashMap<>(); Map mapOld2 = new HashMap<>(); Map mapOld3 = new HashMap<>(); Map mapOld4 = new HashMap<>(); Map mapOld5 = new HashMap<>(); Map mapOld6 = new HashMap<>(); Map mapOld7 = new HashMap<>(); Map mapOld8 = new HashMap<>(); Map mapOld9 = new HashMap<>(); Map mapOld10 = new HashMap<>(); Map mapOld11 = new HashMap<>(); Map mapOld12 = new HashMap<>(); for (Map 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; } @Override public List demandSubCount(PmDemandReqVo pmDemandReqVo) { //是-1就是查询自己及子孙级以下,否则只查询指定部门 if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) { pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId())); } else { pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId())); } List resVos = new ArrayList<>(); //本级和所属采购单位新提报采购需求数量--本年度中本级及下级审核的“需求待提交”之后状态的数据 StatisticalChartsResVo selectSTS = pmDemandMapper.selectSTS(pmDemandReqVo); selectSTS.setColumnName("本级和所属采购单位新提报"); selectSTS.setColumnNamePlus("采购需求数量"); resVos.add(selectSTS); //上年度结转和本年度提报的采购需求累计数量 //1.上年度结转:上年度“需求待提交”之后,“合同待填制”之前状态的数据 //2.本年度提报:指本年度“需求待提交”之后状态的数据 StatisticalChartsResVo lastYear = pmDemandMapper.selectSTSLastYear(pmDemandReqVo); StatisticalChartsResVo thisYear = pmDemandMapper.selectSTSThisYear(pmDemandReqVo); if (ObjectUtils.isEmpty(lastYear.getNum())) { lastYear = new StatisticalChartsResVo(); lastYear.setNum(0); lastYear.setEvaluationTotal(BigDecimal.ZERO); lastYear.setEvaluationContractTotal(BigDecimal.ZERO); } if (ObjectUtils.isEmpty(thisYear.getNum())) { thisYear = new StatisticalChartsResVo(); thisYear.setNum(0); thisYear.setEvaluationTotal(BigDecimal.ZERO); thisYear.setEvaluationContractTotal(BigDecimal.ZERO); } lastYear.setNum(lastYear.getNum() + thisYear.getNum()); lastYear.setEvaluationTotal(lastYear.getEvaluationTotal().add(thisYear.getEvaluationTotal())); lastYear.setColumnName("上年度结转和本年度提报"); lastYear.setColumnNamePlus("采购需求累计数量"); resVos.add(lastYear); //未按季度采购明细计划提报或调整延迟的数量--超过计划需求提报时间的项目 StatisticalChartsResVo meiJiDu = pmDemandMapper.selectmeiJiDu(pmDemandReqVo); meiJiDu.setColumnName("未按季度采购明细计划提报或调整延迟"); meiJiDu.setColumnNamePlus("采购需求数量"); resVos.add(meiJiDu); return resVos; } @Override public List countByProjectType(PmDemandReqVo pmDemandReqVo) { //是-1就是查询自己及子孙级以下,否则只查询指定部门 if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) { pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId())); } else { pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId())); } List resultList = new ArrayList<>(); //项目类型情况统计--根据项目类型:物资类、服务类、工程类、装备类统计项目数量及预算金额 pmDemandReqVo.setProjectType(ProjectTypes.EQUIPMENTTYPE.getCode()); StatisticalChartsResVo res1 = pmDemandMapper.selectByProjectType(pmDemandReqVo); res1.setColumnName(ProjectTypes.EQUIPMENTTYPE.getInfo()); resultList.add(res1); pmDemandReqVo.setProjectType(ProjectTypes.MATERIALTYPE.getCode()); StatisticalChartsResVo res2 = pmDemandMapper.selectByProjectType(pmDemandReqVo); res2.setColumnName(ProjectTypes.MATERIALTYPE.getInfo()); resultList.add(res2); pmDemandReqVo.setProjectType(ProjectTypes.SERVICESTYPE.getCode()); StatisticalChartsResVo res3 = pmDemandMapper.selectByProjectType(pmDemandReqVo); res3.setColumnName(ProjectTypes.SERVICESTYPE.getInfo()); resultList.add(res3); pmDemandReqVo.setProjectType(ProjectTypes.PLANTOEXAMINETYPE.getCode()); StatisticalChartsResVo res4 = pmDemandMapper.selectByProjectType(pmDemandReqVo); res4.setColumnName(ProjectTypes.PLANTOEXAMINETYPE.getInfo()); resultList.add(res4); return resultList; } @Override public List countByPurchaseChange(PmDemandReqVo pmDemandReqVo) { //是-1就是查询自己及子孙级以下,否则只查询指定部门 if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) { pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId())); } else { pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId())); } List byChange = new ArrayList<>(); //本月相关采购机构完成采购任务--状态为“标后质疑”后的数据 StatisticalChartsResVo thisMonth = pmDemandMapper.selectCGThisMonth(pmDemandReqVo); thisMonth.setColumnName("本月相关采购机构"); thisMonth.setColumnNamePlus("完成采购任务数量"); byChange.add(thisMonth); //本季度相关采购机构完成采购任务--状态为“标后质疑”后的数据 StatisticalChartsResVo thisQua = pmDemandMapper.selectCGThisQua(pmDemandReqVo); thisQua.setColumnName("本季度相关采购机构"); thisQua.setColumnNamePlus("完成采购任务数量"); byChange.add(thisQua); //上年度结转和本年度提报的采购需求中累计已完成的采购任务 //上年度结转:上年度“标后质疑”之后,“合同待填制”之前状态的数据 //本年度提报:状态为“标后质疑”后的数据 StatisticalChartsResVo zLastYear = pmDemandMapper.selectZJLastYear(pmDemandReqVo); StatisticalChartsResVo tThisYear = pmDemandMapper.selectTBThisYear(pmDemandReqVo); if (ObjectUtils.isEmpty(zLastYear.getNum())) { zLastYear = new StatisticalChartsResVo(); zLastYear.setNum(0); zLastYear.setEvaluationTotal(BigDecimal.ZERO); zLastYear.setEvaluationContractTotal(BigDecimal.ZERO); } if (ObjectUtils.isEmpty(tThisYear.getNum())) { tThisYear = new StatisticalChartsResVo(); tThisYear.setNum(0); tThisYear.setEvaluationTotal(BigDecimal.ZERO); tThisYear.setEvaluationContractTotal(BigDecimal.ZERO); } //tThisYear.setNum(ObjectUtils.isEmpty(tThisYear.getNum()) ? 0 : tThisYear.getNum() + (ObjectUtils.isEmpty(zLastYear.getNum()) ? 0 : zLastYear.getNum())); //tThisYear.setEvaluationTotal((ObjectUtils.isEmpty(tThisYear.getEvaluationTotal()) ? BigDecimal.ZERO : tThisYear.getEvaluationTotal()).add((ObjectUtils.isEmpty(zLastYear.getEvaluationTotal()) ? BigDecimal.ZERO : zLastYear.getEvaluationTotal()))); //tThisYear.setEvaluationContractTotal((ObjectUtils.isEmpty(tThisYear.getEvaluationContractTotal()) ? BigDecimal.ZERO : tThisYear.getEvaluationContractTotal()).add(ObjectUtils.isEmpty(zLastYear.getEvaluationContractTotal()) ? BigDecimal.ZERO : zLastYear.getEvaluationContractTotal())); tThisYear.setColumnName("上年度结转和本年度提报的采购需求"); tThisYear.setColumnNamePlus("累计完成采购任务数量"); byChange.add(tThisYear); //正常推进周期内的采购任务--本年度项目未超过计划完成采购时间的数据 StatisticalChartsResVo cThisYear = pmDemandMapper.selectCCThisYear(pmDemandReqVo); cThisYear.setColumnName("正常推进周期内"); cThisYear.setColumnNamePlus("采购任务数量"); byChange.add(cThisYear); return byChange; } @Override public AjaxResult exceedReason(PmDemandReqVo pmDemandReqVo) { List resVos = new ArrayList<>(); //是-1就是查询自己及子孙级以下,否则只查询指定部门 if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) { pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId())); } else { pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId())); } //统计超过计划完成采购时间的项目中,处在各阶段的数据包括以下内容: //1、需求编制对接数量/涉及金额:状态为“采购需求对接”的数量及预算金额 List xqdj = new ArrayList<>(); xqdj.add(PmProjectStatus.PURCHASE_DEMAND_DOCKING.getCode()); pmDemandReqVo.setProjectStatusList(xqdj); StatisticalChartsResVo resVo = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo); resVo.setColumnName("需求编制对接数量"); resVos.add(resVo); //2、采购文件编制审核数量/涉及金额:状态为“采购文件编制审核“的数量及预算金额 List wjsh = new ArrayList<>(); wjsh.add(PmProjectStatus.PROCUREMENT_DOCUMENTS_REVIEW.getCode()); pmDemandReqVo.setProjectStatusList(wjsh); StatisticalChartsResVo resVo2 = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo); resVo2.setColumnName("采购文件编制审核数量"); resVos.add(resVo2); //3、质疑、投诉、复议、信访举报数量/涉及金额:按钮”质疑投诉”进行质疑过的项目及预算金额 List demandIdAll = questionHisService.selectDemandIdAll(); pmDemandReqVo.setDemandIdAll(demandIdAll); StatisticalChartsResVo resVo3 = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo); resVo3.setColumnName("质疑、投诉、复议、信访举报数量"); resVos.add(resVo3); //4、流标废标数量/涉及金额:状态为“流废标处置”的项目及预算金额 List fblb = new ArrayList<>(); fblb.add(PmProjectStatus.WASTE_BID_HANDLE.getCode()); pmDemandReqVo.setProjectStatusList(fblb); StatisticalChartsResVo resVo4 = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo); resVo4.setColumnName("流标废标数量"); resVos.add(resVo4); //5、其他原因项目数量/涉及金额:统计“专家意见反馈”、“采购公告发布”、”待开标“、”评标结果公告“、“标后质疑”状态的数据 List qtyy = new ArrayList<>(); qtyy.add(PmProjectStatus.EXPERT_FEEDBACK.getCode()); qtyy.add(PmProjectStatus.PROCUREMENT_ANNOUNCEMENT.getCode()); qtyy.add(PmProjectStatus.WAIT_OPEN_BID.getCode()); qtyy.add(PmProjectStatus.BID_RESULT_ANNOUNCEMENT.getCode()); qtyy.add(PmProjectStatus.POST_BID_QUERY.getCode()); pmDemandReqVo.setProjectStatusList(qtyy); StatisticalChartsResVo resVo5 = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo); resVo5.setColumnName("其他原因项目数量"); resVos.add(resVo5); return AjaxResult.success(resVos); } @Override public AjaxResult exceedReasonZj(PmDemandReqVo pmDemandReqVo) { List resVos = new ArrayList<>(); //是-1就是查询自己及子孙级以下,否则只查询指定部门 if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) { pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId())); } else { pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId())); } //统计超过计划完成采购时间的项目中,处在各阶段的数据包括以下内容: //1、需求编制对接数量/涉及金额:状态为“采购需求对接”的数量及预算金额 List xqdj = new ArrayList<>(); xqdj.add(PmProjectStatus.PURCHASE_DEMAND_DOCKING.getCode()); pmDemandReqVo.setProjectStatusList(xqdj); StatisticalChartsResVo resVo = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo); resVo.setColumnName("需求编制对接数量"); resVos.add(resVo); //2、采购文件编制审核数量/涉及金额:状态为“采购文件编制审核“的数量及预算金额 List wjsh = new ArrayList<>(); wjsh.add(PmProjectStatus.PROCUREMENT_DOCUMENTS_REVIEW.getCode()); pmDemandReqVo.setProjectStatusList(wjsh); StatisticalChartsResVo resVo2 = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo); resVo2.setColumnName("采购文件编制审核数量"); resVos.add(resVo2); //3、质疑、投诉、复议、信访举报数量/涉及金额:按钮”质疑投诉”进行质疑过的项目及预算金额 List demandIdAll = questionHisService.selectDemandIdAll(); pmDemandReqVo.setDemandIdAll(demandIdAll); StatisticalChartsResVo resVo3 = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo); resVo3.setColumnName("质疑、投诉、复议、信访举报数量"); resVos.add(resVo3); //5、其他原因项目数量/涉及金额:统计“专家意见反馈”、“采购公告发布”、”待开标“、”评标结果公告“、“标后质疑”状态的数据 List qtyy = new ArrayList<>(); qtyy.add(PmProjectStatus.EXPERT_FEEDBACK.getCode()); qtyy.add(PmProjectStatus.PROCUREMENT_ANNOUNCEMENT.getCode()); qtyy.add(PmProjectStatus.WAIT_OPEN_BID.getCode()); qtyy.add(PmProjectStatus.BID_RESULT_ANNOUNCEMENT.getCode()); qtyy.add(PmProjectStatus.POST_BID_QUERY.getCode()); pmDemandReqVo.setProjectStatusList(qtyy); StatisticalChartsResVo resVo5 = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo); resVo5.setColumnName("其他原因项目数量"); resVos.add(resVo5); return AjaxResult.success(resVos); } @Override public AjaxResult exceedLink(PmDemandReqVo pmDemandReqVo) { List resVos = new ArrayList<>(); //是-1就是查询自己及子孙级以下,否则只查询指定部门 if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) { pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId())); } else { pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId())); } //滞留环节 //超过计划完成采购时间的各状态数量及占比统计,包括:采购需求对接、采购文件编制审核、标签质疑投诉、待开标、流废标处置、标后质疑 //1、 状态为“采购需求对接”的数量及预算金额 List xqdj = new ArrayList<>(); xqdj.add(PmProjectStatus.PURCHASE_DEMAND_DOCKING.getCode()); pmDemandReqVo.setProjectStatusList(xqdj); StatisticalChartsResVo resVo = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo); resVo.setColumnName("采购需求对接"); resVos.add(resVo); //2、 状态为“采购文件编制审核“的数量及预算金额 List wjsh = new ArrayList<>(); wjsh.add(PmProjectStatus.PROCUREMENT_DOCUMENTS_REVIEW.getCode()); pmDemandReqVo.setProjectStatusList(wjsh); StatisticalChartsResVo resVo2 = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo); resVo2.setColumnName("采购文件编制审核"); resVos.add(resVo2); //3.标前质疑 List bqzy = new ArrayList<>(); bqzy.add(PmProjectStatus.PRE_BID_QUERY.getCode()); pmDemandReqVo.setProjectStatusList(bqzy); StatisticalChartsResVo resVo3 = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo); resVo3.setColumnName("标前质疑投诉"); resVos.add(resVo3); //4、 待开标 List dkb = new ArrayList<>(); dkb.add(PmProjectStatus.WAIT_OPEN_BID.getCode()); pmDemandReqVo.setProjectStatusList(dkb); StatisticalChartsResVo resVo4 = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo); resVo4.setColumnName("待开标"); resVos.add(resVo4); //5、 流废标处置 List lfb = new ArrayList<>(); lfb.add(PmProjectStatus.WASTE_BID_HANDLE.getCode()); pmDemandReqVo.setProjectStatusList(lfb); StatisticalChartsResVo resVo5 = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo); resVo5.setColumnName("流废标处置"); resVos.add(resVo5); //6、 标后质疑 List bhzy = new ArrayList<>(); bhzy.add(PmProjectStatus.POST_BID_QUERY.getCode()); pmDemandReqVo.setProjectStatusList(bhzy); StatisticalChartsResVo resVo6 = pmDemandMapper.countProjectExceedAndStatus(pmDemandReqVo); resVo6.setColumnName("标后质疑"); resVos.add(resVo6); return AjaxResult.success(resVos); } @Override public AjaxResult countPurTask(PmDemandReqVo pmDemandReqVo) { List resVos = new ArrayList<>(); //是-1就是查询自己及子孙级以下,否则只查询指定部门 if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) { pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId())); } else { pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId())); } //1、所属采购服务站数量 //查询现有的采购服务站 SysDictData dictData = new SysDictData(); dictData.setDictType("purchase_services"); List servicesData = dictDataService.selectDictDataList(dictData); StatisticalChartsResVo resVo = new StatisticalChartsResVo(); resVo.setColumnName("所属采购服务站数量"); resVo.setNum(servicesData.size()); resVos.add(resVo); //2、所属采购机构--根据招标代理机构管理中的白名单数据显示 StatisticalChartsResVo resVo2 = pmDemandMapper.countBaseAgencyWithWhite(); resVo2.setColumnName("所属采购机构"); resVos.add(resVo2); //3、新受领集中采购数量--状态为“任务待下达”之后的数据 StatisticalChartsResVo resVo3 = pmDemandMapper.JZCGnum(pmDemandReqVo); resVo3.setColumnName("新受领集中采购数量"); resVos.add(resVo3); //4、上年度结转任务数量 上年度“任务待下达”之后,“合同待填制”之前的状态的数据 List snzj = new ArrayList<>(); snzj.add(PmProjectStatus.TASK_WAIT_RELEASE.getCode()); snzj.add(PmProjectStatus.PURCHASE_DEMAND_DOCKING.getCode()); snzj.add(PmProjectStatus.EXPERT_FEEDBACK.getCode()); snzj.add(PmProjectStatus.PROCUREMENT_DOCUMENTS_REVIEW.getCode()); snzj.add(PmProjectStatus.PROCUREMENT_ANNOUNCEMENT.getCode()); snzj.add(PmProjectStatus.PRE_BID_QUERY.getCode()); snzj.add(PmProjectStatus.WAIT_OPEN_BID.getCode()); snzj.add(PmProjectStatus.BID_RESULT_ANNOUNCEMENT.getCode()); snzj.add(PmProjectStatus.WASTE_BID_HANDLE.getCode()); pmDemandReqVo.setProjectStatusList(snzj); StatisticalChartsResVo resVo4 = pmDemandMapper.countProjecReaAndStatus(pmDemandReqVo); resVo4.setColumnName("上年度结转任务数量"); resVos.add(resVo4); return AjaxResult.success(resVos); } @Override public AjaxResult countMajorProjectNumCGB(PmDemandReqVo pmDemandReqVo) { //新增执行滞后采购任务数量分析 所有的超过计划完成采购时间的数据 //是-1就是查询自己及子孙级以下,否则只查询指定部门 if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) { pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId())); } else { pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId())); } HashMap> resMap = new HashMap<>(); // 查询数据库中最小的年份 int minYear = pmDemandMapper.selectMinYear(); // 获取当前年份 Calendar calendar = Calendar.getInstance(); int thisYear = calendar.get(Calendar.YEAR); List resVos = new LinkedList<>(); for (int i = minYear; i <= thisYear; i++) { pmDemandReqVo.setYear(i); StatisticalChartsResVo byYear = pmDemandMapper.countProjectACT_Year(pmDemandReqVo); resVos.add(byYear); } if (pmDemandReqVo.getTimeType().equals("1")) { resMap.put("年", resVos); } else if (pmDemandReqVo.getTimeType().equals("2")) { List byQuarter = new LinkedList<>(); for (StatisticalChartsResVo chartsResVo : resVos) { pmDemandReqVo.setYear(Integer.parseInt(chartsResVo.getColumnName())); for (int i = 1; i <= 4; i++) { pmDemandReqVo.setQuarter(i); StatisticalChartsResVo quarter = pmDemandMapper.countProjectACT_Qua(pmDemandReqVo); if (ObjectUtils.isEmpty(quarter)) { StatisticalChartsResVo vo = new StatisticalChartsResVo("", "", 0, BigDecimal.valueOf(0), BigDecimal.valueOf(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 byMonth = new LinkedList<>(); for (StatisticalChartsResVo chartsResVo : resVos) { pmDemandReqVo.setYear(Integer.parseInt(chartsResVo.getColumnName())); for (int i = 1; i <= 12; i++) { pmDemandReqVo.setMonth(i); StatisticalChartsResVo month = pmDemandMapper.countProjectACT_Mon(pmDemandReqVo); if (ObjectUtils.isEmpty(month)) { StatisticalChartsResVo vo = new StatisticalChartsResVo("", "", 0, BigDecimal.valueOf(0), BigDecimal.valueOf(0)); month = vo; month.setColumnName(chartsResVo.getColumnName() + "年" + i + "月"); } month.setColumnName(chartsResVo.getColumnName() + "年" + i + "月"); byMonth.add(month); } } resMap.put("月", byMonth); } return AjaxResult.success(resMap); } //查询不同状态下的项目数据 public List getListByStatus(String projectStatus) { LoginUser user = SecurityUtils.getLoginUser(); LambdaQueryWrapper lw = new LambdaQueryWrapper(); // 通过用户ID查询角色 List sysRoles = sysRoleMapper.selectRolePermissionByUserId(user.getUserId()); //需求单位只能查看和操作个人数据 List sysRoleList = sysRoles.stream().filter(tdto -> tdto.getRoleKey().equals("demand_unit")).collect(Collectors.toList()); if (!ObjectUtils.isEmpty(sysRoleList)) { lw.eq(PmDemand::getCreateBy, user.getUserId()); } else if (!projectStatus.equals("5") && !projectStatus.equals("4")) { //需求待提交时不用查审核 List list = new ArrayList<>(); LambdaQueryWrapper l = new LambdaQueryWrapper<>(); l.eq(PmAuditDeptRef::getDeptId, SecurityUtils.getDeptId()); l.eq(PmAuditDeptRef::getRefType, "2"); list = pmAuditDeptRefService.list(l); if (!ObjectUtils.isEmpty(list) && !SysUser.isAdmin(SecurityUtils.getUserId())) { lw.in(PmDemand::getDemandId, list.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toList())); } } lw.in(PmDemand::getProjectStatus, projectStatus); lw.eq(PmDemand::getPurchaseDeptId, SecurityUtils.getDeptId()); lw.last(" order by project_status, plan_demand_sub_time"); return this.baseMapper.selectList(lw); } /** * 查询不同状态下的项目数据(采购办) * 采购执行管理中,本单位超额项目交给上级处理,本单位不处理。 * * @param projectStatus * @return */ public List getListByStatusCGB(String projectStatus) { //登录用户的部门 Long deptId = SecurityUtils.getDeptId(); SysDept sysDept = deptMapper.selectDeptById(deptId); LambdaQueryWrapper lw = new LambdaQueryWrapper(); List list = new ArrayList<>(); LambdaQueryWrapper l = new LambdaQueryWrapper<>(); l.eq(PmAuditDeptRef::getDeptId, deptId); l.eq(PmAuditDeptRef::getRefType, "2"); list = pmAuditDeptRefService.list(l); //本单位所有参与审核的项目id List refList = list.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toList()); //上级参与审核的项目 List refListf = new ArrayList<>(); List listf = new ArrayList<>(); if (sysDept.getParentId() != 0) { LambdaQueryWrapper lf = new LambdaQueryWrapper<>(); lf.eq(PmAuditDeptRef::getDeptId, sysDept.getParentId()); lf.eq(PmAuditDeptRef::getRefType, "2"); listf = pmAuditDeptRefService.list(lf); //上级参与审核的项目id refListf = listf.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toList()); } //取集合差集,只处理差集中的数据 if (!ObjectUtils.isEmpty(refListf)) { refList.removeAll(refListf); } lw.in(PmDemand::getProjectStatus, projectStatus); lw.last(" order by project_status, plan_demand_sub_time"); return this.baseMapper.selectList(lw); } /** * 查询不同状态下的项目数据 * 待办事项--全部 * * @param projectStatus * @return */ public List getListByStatusTotal(List projectStatus) { LambdaQueryWrapper lw = new LambdaQueryWrapper(); List list = new ArrayList<>(); LambdaQueryWrapper l = new LambdaQueryWrapper<>(); l.eq(PmAuditDeptRef::getDeptId, SecurityUtils.getDeptId()); l.eq(PmAuditDeptRef::getRefType, "2"); list = pmAuditDeptRefService.list(l); if (!ObjectUtils.isEmpty(list) && !SysUser.isAdmin(SecurityUtils.getUserId())) { lw.in(PmDemand::getDemandId, list.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toList())); } lw.in(PmDemand::getProjectStatus, projectStatus); lw.eq(PmDemand::getPurchaseDeptId, SecurityUtils.getDeptId()); lw.last(" order by project_status, plan_demand_sub_time"); return this.baseMapper.selectList(lw); } /** * 查询不同状态下的项目数据(采购办) * 采购执行管理中,本单位超额项目交给上级处理,本单位不处理。 * 待办事项--全部 * * @param projectStatus * @return */ public List getListByStatusTotalCGB(List projectStatus) { //登录用户的部门 Long deptId = SecurityUtils.getDeptId(); SysDept sysDept = deptMapper.selectDeptById(deptId); LambdaQueryWrapper lw = new LambdaQueryWrapper(); List list = new ArrayList<>(); LambdaQueryWrapper l = new LambdaQueryWrapper<>(); l.eq(PmAuditDeptRef::getDeptId, deptId); l.eq(PmAuditDeptRef::getRefType, "2"); list = pmAuditDeptRefService.list(l); //本单位所有参与审核的项目id List refList = list.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toList()); //上级参与审核的项目 List refListf = new ArrayList<>(); List listf = new ArrayList<>(); if (sysDept.getParentId() != 0) { LambdaQueryWrapper lf = new LambdaQueryWrapper<>(); lf.eq(PmAuditDeptRef::getDeptId, sysDept.getParentId()); lf.eq(PmAuditDeptRef::getRefType, "2"); listf = pmAuditDeptRefService.list(lf); //上级参与审核的项目id refListf = listf.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toList()); } //取集合差集,只处理差集中的数据 if (!ObjectUtils.isEmpty(refListf)) { refList.removeAll(refListf); } //为空就返回空 if (ObjectUtils.isEmpty(refList) && !SysUser.isAdmin(SecurityUtils.getUserId())) { lw.in(PmDemand::getDemandId, -1); } else if (!ObjectUtils.isEmpty(refList) && !SysUser.isAdmin(SecurityUtils.getUserId())) { lw.in(PmDemand::getDemandId, refList); } lw.in(PmDemand::getProjectStatus, projectStatus); lw.last(" order by project_status, plan_demand_sub_time"); return this.baseMapper.selectList(lw); } //数据转换 @Override public List listToVoList(List demandList) { List pmDemandResponseVoList = new ArrayList<>(); if (!ObjectUtils.isEmpty(demandList) && demandList.size() > 0) { pmDemandResponseVoList = demandChangeTo(demandList); } return pmDemandResponseVoList; } //查询不同状态下的项目数据的数量 @Override public Integer getNumByStatus(String projectStatus) { LoginUser user = SecurityUtils.getLoginUser(); LambdaQueryWrapper lw = new LambdaQueryWrapper(); // 通过用户ID查询角色 List sysRoles = sysRoleMapper.selectRolePermissionByUserId(user.getUserId()); //需求单位只能查看和操作个人数据 List sysRoleList = sysRoles.stream().filter(tdto -> tdto.getRoleKey().equals("demand_unit")).collect(Collectors.toList()); if (!ObjectUtils.isEmpty(sysRoleList)) { lw.eq(PmDemand::getCreateBy, user.getUserId()); } else if (!projectStatus.equals("5") && !projectStatus.equals("4")) { ///需求待提交时不用查审核 List list = new ArrayList<>(); LambdaQueryWrapper l = new LambdaQueryWrapper<>(); l.eq(PmAuditDeptRef::getDeptId, SecurityUtils.getDeptId()); l.eq(PmAuditDeptRef::getRefType, "2"); list = pmAuditDeptRefService.list(l); if (!ObjectUtils.isEmpty(list) && !SysUser.isAdmin(SecurityUtils.getUserId())) { lw.in(PmDemand::getDemandId, list.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toList())); } } lw.eq(PmDemand::getProjectStatus, projectStatus); lw.eq(PmDemand::getPurchaseDeptId, SecurityUtils.getDeptId()); lw.last(" order by project_status, plan_demand_sub_time"); Long count = this.baseMapper.selectCount(lw); return Math.toIntExact(count); } /** * 查询不同状态下的项目数据的数量(采购办首页) * 采购执行管理中,本单位超额项目交给上级处理,本单位不处理。 */ @Override public Integer getNumByStatusCGB(String projectStatus) { //登录用户的部门 Long deptId = SecurityUtils.getDeptId(); SysDept sysDept = deptMapper.selectDeptById(deptId); LambdaQueryWrapper lw = new LambdaQueryWrapper(); List list = new ArrayList<>(); LambdaQueryWrapper l = new LambdaQueryWrapper<>(); l.eq(PmAuditDeptRef::getDeptId, deptId); l.eq(PmAuditDeptRef::getRefType, "2"); list = pmAuditDeptRefService.list(l); //本单位所有参与审核的项目id List refList = list.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toList()); //上级参与审核的项目 List refListf = new ArrayList<>(); List listf = new ArrayList<>(); if (sysDept.getParentId() != 0) { LambdaQueryWrapper lf = new LambdaQueryWrapper<>(); lf.eq(PmAuditDeptRef::getDeptId, sysDept.getParentId()); lf.eq(PmAuditDeptRef::getRefType, "2"); listf = pmAuditDeptRefService.list(lf); //上级参与审核的项目id refListf = listf.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toList()); } //取集合差集,只处理差集中的数据 if (!ObjectUtils.isEmpty(refListf)) { refList.removeAll(refListf); } //为空就返回空 if (ObjectUtils.isEmpty(refList) && !SysUser.isAdmin(SecurityUtils.getUserId())) { lw.in(PmDemand::getDemandId, -1); } else if (!ObjectUtils.isEmpty(refList) && !SysUser.isAdmin(SecurityUtils.getUserId())) { lw.in(PmDemand::getDemandId, refList); } lw.eq(PmDemand::getProjectStatus, projectStatus); lw.last(" order by project_status, plan_demand_sub_time"); Long count = this.baseMapper.selectCount(lw); return Math.toIntExact(count); } //字段转换and赋值 public List demandChangeTo(List pmDemandList) { List pmDemandResponseVoList = new ArrayList<>(); //获取字典数据 HashMap> planEnums = dictTypeService.getAboutEnums(); //项目属性 HashMap projectAttributes = planEnums.get("projectAttributes"); //提前或延后*天进行提醒 List alertTime = dictTypeService.selectDictDataByType("alert_time_setting"); HashMap alertTimeMap = new LinkedHashMap<>(); //根据时间类别设定的提醒时间 for (SysDictData dictData : alertTime) { // 字段名称----阈值 alertTimeMap.put(dictData.getDictLabel(), dictData.getDictValue()); } for (PmDemand pmDemand1 : pmDemandList) { PmDemandResVo vo = new PmDemandResVo(); BeanUtils.copyProperties(pmDemand1, vo); if (vo.getPurchaseDeptId() != null) { Map 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; } } //项目属性为value拼接 if (!ObjectUtils.isEmpty(vo.getProjectAttr())) { if (vo.getProjectAttr().length() > 1) { StringBuilder builder = new StringBuilder(); String[] split = vo.getProjectAttr().split(","); for (String s : split) { for (Map.Entry entry : projectAttributes.entrySet()) { if (s.equals(entry.getValue())) { if (!vo.getProjectAttr().endsWith(s)) { builder.append(entry.getKey() + ","); } else { builder.append(entry.getKey()); } break; } } } vo.setProjectAttrName(builder.toString()); } else { for (Map.Entry entry : projectAttributes.entrySet()) { if (vo.getProjectAttr().equals(entry.getValue())) { vo.setProjectAttrName(entry.getKey()); 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, alertTimeMap)); 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(PmDemandResVo vo, HashMap alertTimeMap) throws ParseException { //首页待办事项--计划完成采购时间提醒 if (ObjectUtils.isEmpty(vo.getRealDemandCommitTime())) { int alertDay2 = Integer.parseInt(alertTimeMap.get("计划提报时间")); Integer alertTime = 1000 * 60 * 60 * 24 * alertDay2; double surplusTwo = vo.getPlanDemandSubTime().getTime() - System.currentTimeMillis(); //少于设定阈值便提醒 if (surplusTwo < alertTime) { //剩余天数(向上取整) int i = (int) Math.ceil(surplusTwo / 1000 / 60 / 60 / 24); if (i > 0) { return "距离计划提报时间不足" + i + "天"; } else { return "已超过计划提报时间" + Math.abs(i) + "天"; } } } //首页待办事项--计划完成采购时间提醒 if (ObjectUtils.isEmpty(vo.getRealPurchaseFinishTime())) { int alertDay2 = Integer.parseInt(alertTimeMap.get("计划完成时间")); Integer alertTime = 1000 * 60 * 60 * 24 * alertDay2; double surplusTwo = vo.getPlanPurchaseFinishTime().getTime() - System.currentTimeMillis(); //少于设定阈值便提醒 if (surplusTwo < alertTime) { //剩余天数(向上取整) int i = (int) Math.ceil(surplusTwo / 1000 / 60 / 60 / 24); if (i > 0) { return "距离计划完成采购时间不足" + i + "天"; } else { return "已超过计划完成采购时间" + Math.abs(i) + "天"; } } } //首页待办事项--计划交付时间提醒 if (ObjectUtils.isEmpty(vo.getRealDeliverTime())) { Date deliverTime = vo.getPlanDeliverTime(); int alertDay = Integer.parseInt(alertTimeMap.get("计划交付(实施)时间")); Integer remindTine = 1000 * 60 * 60 * 24 * alertDay; double surplus = deliverTime.getTime() - System.currentTimeMillis(); if (surplus < remindTine) { //剩余天数(向上取整) int i = (int) Math.ceil(surplus / 1000 / 60 / 60 / 24); 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); } //查询本单位及本级一下全部 public List isQueryAll(Integer queryAll) { List deptList = new ArrayList<>(); Long deptId = SecurityUtils.getDeptId(); //查询全部 if (queryAll.equals(-1)) { //获取到子孙级部门id if (deptService.hasChildByDeptId(SecurityUtils.getDeptId())) { List children = deptService.getDeptChildren(deptId); System.err.println(children.size()); deptList.addAll(children); } deptList.add(deptId); } return deptList; } //查询本单位还是本单位及子孙级----要查询子单位的超额数据 @Override public List isQueryZD(Integer queryZd) { //指定部门--以及子单位的超额数据 List demandId = new ArrayList<>(); //先获取本部门的项目 LambdaQueryWrapper ld = new LambdaQueryWrapper<>(); ld.eq(PmDemand::getPurchaseDeptId, queryZd); //本部门的项目 List deList = pmDemandMapper.selectList(ld); for (PmDemand demand : deList) { demandId.add(demand.getDemandId()); } if (deptService.hasChildByDeptId(Long.valueOf(queryZd))) { //获取子级部门d List childByDeptId = deptService.getChildIdByDeptId(Long.valueOf(queryZd)); //取出所有可以进行统计的项目id for (Long cid : childByDeptId) { LambdaQueryWrapper ll = new LambdaQueryWrapper<>(); ll.eq(PmAuditDeptRef::getDeptId, cid); ll.eq(PmAuditDeptRef::getRefType, "2"); //子部门参加审核的项目 List refList = pmAuditDeptRefService.list(ll); //同一个数据有上级参与说明是超额 for (PmAuditDeptRef ref : refList) { //获取上级并查询是否参与审核 SysDept dept = deptService.selectByCid(ref.getDeptId()); //是否参与审核 LambdaQueryWrapper pp = new LambdaQueryWrapper<>(); ll.eq(PmAuditDeptRef::getDeptId, dept.getDeptId()); ll.eq(PmAuditDeptRef::getRefId, ref.getRefId()); //取出父级部门参加审核的项目(超额项目) List refListP = pmAuditDeptRefService.list(pp); if (!ObjectUtils.isEmpty(refListP)) { demandId.add(ref.getRefId()); } } } } return demandId; } }