Procházet zdrojové kódy

续建项目 能关联的项目

master
PoffyZhang před 11 měsíci
rodič
revize
9211ac94ea
5 změnil soubory, kde provedl 149 přidání a 34 odebrání
  1. +2
    -14
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java
  2. +9
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectRenewalFundDeclarationController.java
  3. +48
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectRenewwalFundHelper.java
  4. +12
    -15
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java
  5. +78
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java

+ 2
- 14
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java Zobrazit soubor

@@ -1,5 +1,6 @@
package com.ningdatech.pmapi.projectdeclared.manage;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSON;
@@ -380,20 +381,7 @@ public class DeclaredProjectManage {
return PageVo.empty();
}
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> {
ProjectLibListItemVO item = new ProjectLibListItemVO();
item.setId(w.getId());
item.setProjectName(w.getProjectName());
item.setCreateOn(w.getCreateOn());
item.setDeclaredAmount(w.getDeclareAmount());
item.setStage(w.getStage());
item.setStatus(w.getStatus());
item.setProjectType(w.getProjectType());
item.setProjectYear(w.getProjectYear());
item.setBuildOrg(w.getBuildOrgName());
item.setBizDomain(w.getBizDomain());
item.setProcessStatus(w.getProcessStatus());
item.setInstCode(w.getInstCode());
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg());
ProjectLibListItemVO item = BeanUtil.copyProperties(w,ProjectLibListItemVO.class);
return item;
});
return PageVo.of(records, total);


+ 9
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectRenewalFundDeclarationController.java Zobrazit soubor

@@ -7,8 +7,10 @@ import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.common.util.ExcelDownUtil;
import com.ningdatech.pmapi.projectlib.manage.ProjectRenewalFundManage;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectRenewalFundDeclarationDTO;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.req.ProjectRenewalAuditReq;
import com.ningdatech.pmapi.projectlib.model.req.ProjectRenewalListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectRenewalFundDeclarationVO;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
@@ -39,12 +41,18 @@ public class ProjectRenewalFundDeclarationController {

@GetMapping("/list")
@ApiOperation("项目续建资金库")
@WebLog("项目续建资金库")
public PageVo<ProjectRenewalFundDeclarationVO> list(ProjectRenewalListReq req) {
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId());
return projectRenewalFundManage.list(req,user);
}

@GetMapping("/project-list")
@ApiOperation("项目续建资金库能关联的项目列表")
public PageVo<ProjectLibListItemVO> projectlist(ProjectRenewalListReq req) {
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId());
return projectRenewalFundManage.projectlist(req,user);
}

@GetMapping("/{id}")
@ApiOperation("项目续建资金详情")
@WebLog("项目续建资金详情")


+ 48
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectRenewwalFundHelper.java Zobrazit soubor

@@ -0,0 +1,48 @@
package com.ningdatech.pmapi.projectlib.helper;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.req.ProjectRenewalListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.Map;

/**
* <p>
* ProjectRenewwalFundHelper
* </p>
*
* @author ZPF
* @since 14:15 2023/11/16
*/
public class ProjectRenewwalFundHelper {

/**
* 通用项目查询
*
* @param req 查询条件
* @return /
**/
public static LambdaQueryWrapper<Project> projectQuery(ProjectRenewalListReq req) {
LambdaQueryWrapper<Project> query = new LambdaQueryWrapper<>();
query.eq(req.getRegionCode() != null, Project::getAreaCode, req.getRegionCode())
.eq(req.getUserId() != null, Project::getCreateBy, req.getUserId())
.like(req.getProjectName() != null, Project::getProjectName, req.getProjectName())
.eq(req.getProjectType() != null, Project::getProjectType, req.getProjectType())
.eq(req.getStage() != null, Project::getStage, req.getStage())
.eq(req.getStatus() != null, Project::getStatus, req.getStatus())

//状态 阶段 list
.in(CollUtil.isNotEmpty(req.getStageList()),Project::getStage,req.getStageList())
.in(CollUtil.isNotEmpty(req.getStatusList()),Project::getStatus,req.getStatusList())
.orderByDesc(Project::getUpdateOn);
return query;
}
}

+ 12
- 15
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java Zobrazit soubor

@@ -138,18 +138,18 @@ public class ProjectLibManage {
query.eq(Project::getNewest, Boolean.TRUE);
Page<Project> page = projectService.page(req.page(), query);
long total;
if ((total = page.getTotal()) == 0) {
if (CollUtil.isEmpty(page.getRecords())) {
return PageVo.empty();
}

//已验收项目ID
List<Long> acceptedProjectId = page.getRecords().stream().filter(p -> ProjectStatusEnum.ACCEPTED.getCode().equals(p.getStatus()))
.map(Project::getId).collect(Collectors.toList());
//
List<String> projectCodes = page.getRecords().stream()
.map(Project::getProjectCode).collect(Collectors.toList());

Map<Long,List<ProjectRenewalFundDeclaration>> renewalMap = Maps.newHashMap();
if(CollUtil.isNotEmpty(acceptedProjectId)){
if(CollUtil.isNotEmpty(projectCodes)){
List<ProjectRenewalFundDeclaration> renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class)
.in(ProjectRenewalFundDeclaration::getProjectId, acceptedProjectId)
.in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes)
.eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name())
.eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE)
.orderByAsc(ProjectRenewalFundDeclaration::getProjectYear));
@@ -185,7 +185,7 @@ public class ProjectLibManage {
}
return item;
});
return PageVo.of(records, total);
return PageVo.of(records, page.getTotal());
}

public PageVo<ProjectLibListItemVO> projectLibListWithPermission(ProjectListReq req, UserFullInfoDTO user) {
@@ -218,14 +218,11 @@ public class ProjectLibManage {
Map<String, List<ProjectTag>> finalTagMap = tagMap;
Map<Long,String> finalTagNameMap = tagNameMap;

//已验收项目ID
List<Long> acceptedProjectId = page.getRecords().stream().filter(p -> ProjectStatusEnum.ACCEPTED.getCode().equals(p.getStatus()))
.map(Project::getId).collect(Collectors.toList());

Map<Long,List<ProjectRenewalFundDeclaration>> renewalMap = Maps.newHashMap();
if(CollUtil.isNotEmpty(acceptedProjectId)){
if(CollUtil.isNotEmpty(projectCodes)){
List<ProjectRenewalFundDeclaration> renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class)
.in(ProjectRenewalFundDeclaration::getProjectId, acceptedProjectId)
.in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes)
.eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name())
.eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE)
.orderByAsc(ProjectRenewalFundDeclaration::getProjectYear));
@@ -444,7 +441,7 @@ public class ProjectLibManage {
return PageVo.of(records, page.getTotal());
}

private BigDecimal computeAmount(BigDecimal cuurentAmount,List<ProjectRenewalFundDeclaration> prfs) {
public static BigDecimal computeAmount(BigDecimal cuurentAmount,List<ProjectRenewalFundDeclaration> prfs) {
BigDecimal res = Objects.isNull(cuurentAmount) ? BigDecimal.ZERO : cuurentAmount;
for(ProjectRenewalFundDeclaration prf : prfs){
res = res.add(prf.getAnnualPaymentAmount());
@@ -452,7 +449,7 @@ public class ProjectLibManage {
return res;
}

private List<AnnualAmountVO> convertAccmulate(ProjectPO project,List<ProjectRenewalFundDeclaration> prfs) {
public static List<AnnualAmountVO> convertAccmulate(ProjectPO project,List<ProjectRenewalFundDeclaration> prfs) {
List<AnnualAmountVO> annualAmounts = Lists.newArrayList();
annualAmounts.add(AnnualAmountVO.builder()
.projectId(project.getId())
@@ -469,7 +466,7 @@ public class ProjectLibManage {
return annualAmounts;
}

private List<AnnualAmountVO> convertAccmulate(Project project,List<ProjectRenewalFundDeclaration> prfs) {
public static List<AnnualAmountVO> convertAccmulate(Project project,List<ProjectRenewalFundDeclaration> prfs) {
List<AnnualAmountVO> annualAmounts = Lists.newArrayList();
annualAmounts.add(AnnualAmountVO.builder()
.projectId(project.getId())


+ 78
- 4
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java Zobrazit soubor

@@ -1,10 +1,13 @@
package com.ningdatech.pmapi.projectlib.manage;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
@@ -26,11 +29,15 @@ import com.ningdatech.pmapi.gov.service.IGovBizProjectApplyService;
import com.ningdatech.pmapi.gov.service.IGovBizProjectApproveService;
import com.ningdatech.pmapi.gov.service.IGovBizProjectBaseinfoService;
import com.ningdatech.pmapi.gov.service.IGovOperationProjectBaseinfoService;
import com.ningdatech.pmapi.portrait.model.entity.ProjectTag;
import com.ningdatech.pmapi.portrait.model.entity.Tag;
import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectRenewalDeclareExportDTO;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectRenewalApprovalStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeNewEnum;
import com.ningdatech.pmapi.projectlib.helper.ProjectHelper;
import com.ningdatech.pmapi.projectlib.helper.ProjectRenewwalFundHelper;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectRenewalExportDTO;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectRenewalFundDeclarationDTO;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
@@ -40,6 +47,7 @@ import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.req.ProjectRenewalAuditReq;
import com.ningdatech.pmapi.projectlib.model.req.ProjectRenewalListReq;
import com.ningdatech.pmapi.projectlib.model.vo.AnnualAmountVO;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectRenewalFundDeclarationVO;
import com.ningdatech.pmapi.projectlib.service.IProjectRenewalFundDeclarationService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
@@ -56,10 +64,7 @@ import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.*;
import java.util.stream.Collectors;

/**
@@ -110,6 +115,75 @@ public class ProjectRenewalFundManage {
return PageVo.of(records, total);
}

public PageVo<ProjectLibListItemVO> projectlist(ProjectRenewalListReq req, UserFullInfoDTO user) {
LambdaQueryWrapper<Project> query = ProjectRenewwalFundHelper.projectQuery(req);
//项目查最新
query.eq(Project::getNewest, Boolean.TRUE);
//自己单位
query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode());
//立项批复到初验
query.gt(Project::getStatus,ProjectStatusEnum.APPROVED_AFTER_CHOICE.getCode());
query.le(Project::getStatus,ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
Page<Project> page = projectService.page(req.page(), query);
if (CollUtil.isEmpty(page.getRecords())) {
return PageVo.empty();
}
UserFullInfoDTO finalUser = user;

Set<String> projectCodes = page.getRecords().stream()
.map(Project::getProjectCode).collect(Collectors.toSet());

Map<Long,List<ProjectRenewalFundDeclaration>> renewalMap = Maps.newHashMap();
if(CollUtil.isNotEmpty(projectCodes)){
List<ProjectRenewalFundDeclaration> renewalDeclarations = projectRenewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class)
.in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes)
.eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name())
.eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE)
.orderByAsc(ProjectRenewalFundDeclaration::getProjectYear));
renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId));
}

Map<Long, List<ProjectRenewalFundDeclaration>> finalRenewalMap = renewalMap;
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> {
ProjectLibListItemVO item = new ProjectLibListItemVO();
item.setId(w.getId());
item.setProjectName(w.getProjectName());
item.setProjectCode(w.getProjectCode());
item.setArea(w.getArea());
item.setAreaCode(w.getAreaCode());
item.setCreateOn(w.getCreateOn());
item.setDeclaredAmount(w.getDeclareAmount());
item.setStage(w.getStage());
item.setStatus(w.getStatus());
item.setProjectType(w.getProjectType());
item.setProjectYear(w.getProjectYear());
item.setBuildOrg(w.getBuildOrgName());
item.setBizDomain(w.getBizDomain());
item.setProcessStatus(w.getProcessStatus());
item.setInstCode(w.getInstCode());
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg());
if (finalUser.getIsOrgAdmin() &&
ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus())
&& StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode())
&& w.getSuperOrgCode().equals(finalUser.getEmpPosUnitCode())) {
item.setCanPreDeclared(Boolean.TRUE);
}
item.setApprovedAmount(w.getApprovalAmount());
item.setAnnualPlanAmount(w.getAnnualPlanAmount());
item.setPrePlanProjectId(w.getPrePlanProjectId());
if(finalRenewalMap.containsKey(item.getId())){
List<ProjectRenewalFundDeclaration> prfs = finalRenewalMap.get(item.getId());
item.setAnnualAccumulateAmount(ProjectLibManage.computeAmount(w.getAnnualPlanAmount(),prfs));
item.setAnnualAccumulateAmountList(ProjectLibManage.convertAccmulate(w,prfs));
}else{
item.setAnnualAccumulateAmount(w.getAnnualPlanAmount());
item.setAnnualAccumulateAmountList(ProjectLibManage.convertAccmulate(w,Collections.emptyList()));
}
return item;
});
return PageVo.of(records, page.getTotal());
}

/**
* @param id
* @author ZPF


Načítá se…
Zrušit
Uložit