diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java index ad3203c..a6c7d3a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java @@ -3,7 +3,10 @@ package com.ningdatech.pmapi.projectlib.helper; import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.vo.ProjectApplicationVO; +import org.springframework.beans.BeanUtils; /** *

@@ -48,4 +51,14 @@ public class ProjectHelper { return query; } + /** + * 转换VO + * @param app + * @return + */ + public static ProjectApplicationVO convertVO(ProjectApplication app) { + ProjectApplicationVO appVo = new ProjectApplicationVO(); + BeanUtils.copyProperties(app, appVo); + return appVo; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index c3cbd08..d75c9d2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -3,21 +3,26 @@ package com.ningdatech.pmapi.projectlib.manage; 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.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration; import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO; +import com.ningdatech.pmapi.projectlib.model.vo.AnnualAmountVO; import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; +import com.ningdatech.pmapi.projectlib.service.IProjectRenewalFundDeclarationService; import com.ningdatech.pmapi.projectlib.service.IProjectService; import lombok.RequiredArgsConstructor; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; +import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.Optional; @@ -38,6 +43,8 @@ public class ProjectLibManage { private final IProjectApplicationService applicationService; + private final IProjectRenewalFundDeclarationService renewalFundDeclarationService; + public PageVo projectLibList(ProjectListReq req) { LambdaQueryWrapper query = ProjectHelper.projectQuery(req); Page page = projectService.page(req.page(), query); @@ -79,18 +86,34 @@ public class ProjectLibManage { BeanUtils.copyProperties(projectInfo, vo); vo.buildDynamicForm(projectInfo.getDynamicForm()); // 查询应用 - if(Objects.nonNull(vo)){ - List applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectId, vo.getId())); - Optional.ofNullable(applications).ifPresent(apps -> - vo.setProjectApplications(CollUtils.convert(apps, - app-> { - ProjectApplicationVO appVo = new ProjectApplicationVO(); - BeanUtils.copyProperties(app, appVo); - return appVo; - } - ) - )); + List applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectId, vo.getId())); + Optional.ofNullable(applications).ifPresent(apps -> + vo.setProjectApplications(CollUtils.convert(apps, + ProjectHelper::convertVO) + )); + + //查询年度投资金额 要是已验收的项目 + if(ProjectStatusEnum.ACCEPTED.getCode().equals(projectInfo.getStatus())){ + List annualAmounts = Lists.newArrayList(); + annualAmounts.add(AnnualAmountVO.builder() + .projectId(projectInfo.getId()) + .projectYear(projectInfo.getProjectYear()) + .annualAmount(projectInfo.getAnnualPlanAmount()) + .build()); + List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) + .eq(ProjectRenewalFundDeclaration::getProjectId, vo.getId()) + .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); + Optional.ofNullable(renewalDeclarations).ifPresent(declarations -> + declarations.forEach(declaration -> { + annualAmounts.add(AnnualAmountVO.builder() + .projectId(projectInfo.getId()) + .projectYear(declaration.getProjectYear()) + .annualAmount(declaration.getAnnualPaymentAmount()) + .build()); + }) + ); + vo.setAnnualAccumulateAmountList(annualAmounts); } return vo; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java index 8f61c13..121ac74 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java @@ -118,52 +118,52 @@ public class Project implements Serializable { @ApiModelProperty("项目简介") private String projectIntroduction; - @ApiModelProperty("资金申报情况-申报金额(万元)") + @ApiModelProperty("资金申报情况-申报金额(元)") private BigDecimal declareAmount; - @ApiModelProperty("资金申报情况-自有金额(万元)") + @ApiModelProperty("资金申报情况-自有金额(元)") private BigDecimal declareHaveAmount; - @ApiModelProperty("资金申报情况-政府投资-本级财政资金(万元)") + @ApiModelProperty("资金申报情况-政府投资-本级财政资金(元)") private BigDecimal declareGovOwnFinanceAmount; - @ApiModelProperty("资金申报情况-政府投资-上级补助资金(万元)") + @ApiModelProperty("资金申报情况-政府投资-上级补助资金(元)") private BigDecimal declareGovSuperiorFinanceAmount; - @ApiModelProperty("银行贷款(万元)") + @ApiModelProperty("银行贷款(元)") private BigDecimal declareBankLendingAmount; - @ApiModelProperty("其它资金(万元)") + @ApiModelProperty("其它资金(元)") private BigDecimal declareOtherAmount; - @ApiModelProperty("资金分配情况-软件开发(万元)") + @ApiModelProperty("资金分配情况-软件开发(元)") private BigDecimal softwareDevelopmentAmount; - @ApiModelProperty("资金分配情况-云资源、硬件购置(万元)") + @ApiModelProperty("资金分配情况-云资源、硬件购置(元)") private BigDecimal cloudHardwarePurchaseAmount; - @ApiModelProperty("资金分配情况-第三方服务(万元)") + @ApiModelProperty("资金分配情况-第三方服务(元)") private BigDecimal thirdPartyAmount; - @ApiModelProperty("年度支付计划-年度支付计划(万元)") + @ApiModelProperty("年度支付计划-年度支付计划(元)") private BigDecimal annualPlanAmount; - @ApiModelProperty("年度支付计划-自有金额(万元)") + @ApiModelProperty("年度支付计划-自有金额(元)") private BigDecimal annualPlanHaveAmount; - @ApiModelProperty("年度支付计划-政府投资-本级财政资金(万元)") + @ApiModelProperty("年度支付计划-政府投资-本级财政资金(元)") private BigDecimal annualPlanGovOwnFinanceAmount; - @ApiModelProperty("年度支付计划-政府投资-上级补助资金(万元)") + @ApiModelProperty("年度支付计划-政府投资-上级补助资金(元)") private BigDecimal annualPlanGovSuperiorFinanceAmount; - @ApiModelProperty("年度支付计划-银行贷款(万元)") + @ApiModelProperty("年度支付计划-银行贷款(元)") private BigDecimal annualPlanBankLendingAmount; - @ApiModelProperty("年度支付计划-其它资金(万元)") + @ApiModelProperty("年度支付计划-其它资金(元)") private BigDecimal annualPlanOtherAmount; - @ApiModelProperty("立项批复资金(万元)") + @ApiModelProperty("立项批复资金(元)") private BigDecimal approvalAmount; private LocalDateTime annualPlanAddTime; @@ -177,7 +177,7 @@ public class Project implements Serializable { @ApiModelProperty("安全投入-内容描述") private String safetyInputDescribe; - @ApiModelProperty("安全投入-金额(万元)") + @ApiModelProperty("安全投入-金额(元)") private BigDecimal safetyInputAmount; @ApiModelProperty("附件-初步方案") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/AnnualAmountVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/AnnualAmountVO.java new file mode 100644 index 0000000..53a1f27 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/AnnualAmountVO.java @@ -0,0 +1,32 @@ +package com.ningdatech.pmapi.projectlib.model.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +/** + * @Classname AnnualAmountVO + * @Description + * @Date 2023/2/17 13:37 + * @Author PoffyZhang + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class AnnualAmountVO { + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("年份") + private Integer projectYear; + + @ApiModelProperty("年度投资资金") + private BigDecimal annualAmount; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java index 231b312..a15c074 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java @@ -274,6 +274,9 @@ public class ProjectDetailVO { @ApiModelProperty("动态form") private Map dynamicForm; + @ApiModelProperty("年度投资金额详情") + private List annualAccumulateAmountList; + private String projectTypeName; public String getProjectTypeName() { diff --git a/pmapi/src/test/resources/security/auth-dev.yml b/pmapi/src/test/resources/security/auth-dev.yml index 448ffa2..b6e94cf 100644 --- a/pmapi/src/test/resources/security/auth-dev.yml +++ b/pmapi/src/test/resources/security/auth-dev.yml @@ -49,4 +49,5 @@ security: - /api/v1/user-info/save - /api/v1/user-info/del - /api/v1/user-info/kick-off/** - - /api/v1/user-info/password/mod \ No newline at end of file + - /api/v1/user-info/password/mod + - /api/v1/** \ No newline at end of file