Browse Source

增加decimal工具类

tags/24080901
WendyYang 10 months ago
parent
commit
2208bdd969
15 changed files with 226 additions and 72 deletions
  1. +1
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/common/util/BizUtils.java
  2. +81
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/common/util/DecimalUtil.java
  3. +2
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/converter/ApplicationConverter.java
  4. +34
    -7
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java
  5. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java
  6. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/MhProjectController.java
  7. +2
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java
  8. +42
    -19
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java
  9. +29
    -9
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java
  10. +0
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.xml
  11. +3
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectDTO.java
  12. +3
    -24
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/Project.java
  13. +2
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectPaymentPlan.java
  14. +23
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectPaymentPlanService.java
  15. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java

+ 1
- 0
hz-pm-api/src/main/java/com/hz/pm/api/common/util/BizUtils.java View File

@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONArray;
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum;
import com.ningdatech.basic.util.StrPool;
import com.ningdatech.file.entity.vo.result.FileResultVO;
import liquibase.pro.packaged.O;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.NumberUtils;



+ 81
- 0
hz-pm-api/src/main/java/com/hz/pm/api/common/util/DecimalUtil.java View File

@@ -0,0 +1,81 @@
package com.hz.pm.api.common.util;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ArrayUtil;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.function.Function;

/**
* <p>
* DecimalUtil
* </p>
*
* @author WendyYang
* @since 18:53 2024/2/21
*/
public class DecimalUtil {

private DecimalUtil() {
}

@SafeVarargs
public static <T> BigDecimal sum(Collection<T> objs, Function<T, BigDecimal>... functions) {
if (CollUtil.isEmpty(objs) || ArrayUtil.isEmpty(functions)) {
return BigDecimal.ZERO;
}
return objs.stream()
.map(w -> Arrays.stream(functions)
.map(f -> f.apply(w))
.reduce(BigDecimal::add)
.orElse(BigDecimal.ZERO))
.reduce(BigDecimal::add)
.orElse(BigDecimal.ZERO);

}

public static <T> BigDecimal avg(Collection<T> objs, Function<T, BigDecimal> function) {
if (CollUtil.isEmpty(objs)) {
return BigDecimal.ZERO;
}
BigDecimal size = BigDecimal.valueOf(objs.size());
return objs.stream()
.map(function)
.reduce(BigDecimal::add)
.orElse(BigDecimal.ZERO)
.divide(size, RoundingMode.HALF_UP);
}

public static <T> BigDecimal max(Collection<T> objs, Function<T, BigDecimal> function) {
if (CollUtil.isEmpty(objs)) {
return BigDecimal.ZERO;
}
return objs.stream().map(function).max(BigDecimal::compareTo).orElse(BigDecimal.ZERO);
}

public static <T> BigDecimal min(Collection<T> objs, Function<T, BigDecimal> function) {
if (CollUtil.isEmpty(objs)) {
return BigDecimal.ZERO;
}
return objs.stream().map(function).min(BigDecimal::compareTo).orElse(BigDecimal.ZERO);
}

public static <T> T objByMax(Collection<T> objs, Function<T, BigDecimal> function) {
if (CollUtil.isEmpty(objs)) {
return null;
}
return objs.stream().max(Comparator.comparing(function)).orElse(null);
}

public static <T> T objByMin(Collection<T> objs, Function<T, BigDecimal> function) {
if (CollUtil.isEmpty(objs)) {
return null;
}
return objs.stream().min(Comparator.comparing(function)).orElse(null);
}

}

+ 2
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/converter/ApplicationConverter.java View File

@@ -43,7 +43,8 @@ public class ApplicationConverter {
.projectId(projectInfo.getProjectCode())
.projectType(convertProjectType(projectInfo.getProjectType()))
.totalMoney(projectInfo.getDeclareAmount())
.yearBudget(projectInfo.getAnnualPlanAmount())
// TODO
.yearBudget(BigDecimal.ZERO)
.budgetFrom(checkAddBudget(projectInfo.getDeclareHaveAmount()
, projectInfo.getDeclareGovOwnFinanceAmount(),
projectInfo.getDeclareGovSuperiorFinanceAmount(),


+ 34
- 7
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java View File

@@ -27,10 +27,12 @@ import com.hz.pm.api.projectdeclared.service.IPreInsAcceptancePersonService;
import com.hz.pm.api.projectdeclared.service.IPurchaseService;
import com.hz.pm.api.projectlib.helper.ProjectHelper;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.entity.ProjectPaymentPlan;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum;
import com.hz.pm.api.projectlib.model.req.ProjectListReq;
import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO;
import com.hz.pm.api.projectlib.service.IProjectPaymentPlanService;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.user.security.model.UserFullInfoDTO;
import com.hz.pm.api.user.security.model.UserInfoDetails;
@@ -51,10 +53,7 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;

@@ -81,6 +80,7 @@ public class ConstructionManage {
private final IPreInsAcceptancePersonService acceptancePersonService;

private final StateMachineUtil stateMachineUtil;
private final IProjectPaymentPlanService projectPaymentPlanService;

/**
* 待采购的-项目列表
@@ -381,6 +381,16 @@ public class ConstructionManage {
if ((total = page.getTotal()) == 0) {
return PageVo.empty();
}

Set<String> projectCodes = new HashSet<>();
List<Long> projectIds = new ArrayList<>();
for (Project project : page.getRecords()) {
projectIds.add(project.getId());
projectCodes.add(project.getProjectCode());
}

Map<Long, List<ProjectPaymentPlan>> paymentPlansMap = projectPaymentPlanService.listByProjectIds(projectIds);

List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> {
ProjectLibListItemVO item = new ProjectLibListItemVO();
item.setId(w.getId());
@@ -400,7 +410,11 @@ public class ConstructionManage {
item.setApprovalDate(w.getApprovalDate());
item.setDeliveryTime(w.getDeliveryTime());
item.setContractAmount(w.getContractAmount());
item.setAnnualPlanAmount(w.getAnnualPlanAmount());
List<ProjectPaymentPlan> paymentPlans = paymentPlansMap.getOrDefault(w.getId(), Collections.emptyList());
BigDecimal totalAnnualAmount = paymentPlans.stream()
.map(ProjectPaymentPlan::getAnnualPlanAmount)
.reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
item.setAnnualPlanAmount(totalAnnualAmount);
item.setTransactionTime(w.getTransactionTime());
item.setTransactionAmount(w.getTransactionAmount());
return item;
@@ -425,6 +439,13 @@ public class ConstructionManage {

List<DeclaredProjectExportDTO> collect = Lists.newArrayList();
if (CollUtil.isNotEmpty(records)) {
List<Long> projectIds = new ArrayList<>();
for (Project project : records) {
projectIds.add(project.getId());
}

Map<Long, List<ProjectPaymentPlan>> paymentPlansMap = projectPaymentPlanService.listByProjectIds(projectIds);

AtomicInteger serialNumber = new AtomicInteger(0);
collect = records.stream().map(r -> {
DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO();
@@ -436,7 +457,13 @@ public class ConstructionManage {
exportDTO.setSerialNumber(serialNumber.incrementAndGet());
exportDTO.setDeliveryTime(r.getDeliveryTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
exportDTO.setContractAmount(r.getContractAmount());
exportDTO.setAnnualPlanAmount(r.getAnnualPlanAmount());

List<ProjectPaymentPlan> paymentPlans = paymentPlansMap.getOrDefault(r.getId(), Collections.emptyList());
BigDecimal totalAnnualAmount = paymentPlans.stream()
.map(ProjectPaymentPlan::getAnnualPlanAmount)
.reduce(BigDecimal::add).orElse(BigDecimal.ZERO);

exportDTO.setAnnualPlanAmount(totalAnnualAmount);
if (Objects.nonNull(r.getTransactionTime())) {
exportDTO.setTransactionTime(r.getTransactionTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
}
@@ -445,7 +472,7 @@ public class ConstructionManage {
}).collect(Collectors.toList());
}

String fileName = "合同备案项目列表";
final String fileName = "合同备案项目列表";
ExcelDownUtil.setFileName(fileName, response);
//数据导出处理函数
try {


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java View File

@@ -121,7 +121,7 @@ public class ReviewChecklistManage {
item.setProcessStatus(w.getProcessStatus());
item.setInstCode(w.getInstCode());
item.setApprovedAmount(w.getApprovalAmount());
item.setAnnualPlanAmount(w.getAnnualPlanAmount());
// item.setAnnualPlanAmount(w.getAnnualPlanAmount());
// 审查人员情况
item.setVerifiedHumans(computeVerify(item, approveMap.get(w.getProjectCode()), userMap, user));
item.setReviewCheckFinish(w.getReviewCheckFinish());


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/MhProjectController.java View File

@@ -21,7 +21,7 @@ import javax.validation.Valid;
* @author WendyYang
* @since 2024-01-30
*/
@Api(tags = "信产项目(立项备案)列表")
@Api(tags = "信产项目(立项备案)相关接口")
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v1/declared/record")


+ 2
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java View File

@@ -344,7 +344,8 @@ public class AnnualPlanLibManage {
project.setBeginTime(dataArr[0].trim());
project.setEndTime(dataArr[1].trim());
project.setDeclareAmount(data.getDeclaredAmount());
project.setAnnualPlanAmount(data.getAnnualPlanAmount());
// TODO 年度计划
// project.setAnnualPlanAmount(data.getAnnualPlanAmount());
project.setDeclareHaveAmount(data.getDeclareHaveAmount());
project.setDeclareGovOwnFinanceAmount(data.getDeclareGovOwnFinanceAmount());
project.setDeclareGovSuperiorFinanceAmount(data.getDeclareGovSuperiorFinanceAmount());


+ 42
- 19
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java View File

@@ -5,6 +5,7 @@ import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@@ -93,6 +94,7 @@ import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.Array;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
@@ -146,10 +148,14 @@ public class ProjectLibManage {
if (CollUtil.isEmpty(page.getRecords())) {
return PageVo.empty();
}

List<String> projectCodes = page.getRecords().stream()
.map(Project::getProjectCode).collect(Collectors.toList());
Set<String> projectCodes = new HashSet<>();
List<Long> projectIds = new ArrayList<>();
for (Project project : page.getRecords()) {
projectIds.add(project.getId());
projectCodes.add(project.getProjectCode());
}
Map<Long, List<ProjectRenewalFundDeclaration>> renewalMap = listRenewDeclarations(projectCodes);
Map<Long, List<ProjectPaymentPlan>> paymentPlansMap = projectPaymentPlanService.listByProjectIds(projectIds);

List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> {
ProjectLibListItemVO item = new ProjectLibListItemVO();
@@ -169,13 +175,18 @@ public class ProjectLibManage {
item.setProcessStatus(w.getProcessStatus());
item.setInstCode(w.getInstCode());
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg());
List<ProjectPaymentPlan> paymentPlans = paymentPlansMap.getOrDefault(w.getId(), Collections.emptyList());
BigDecimal totalAnnualPaymentAmount = paymentPlans.stream()
.map(ProjectPaymentPlan::getAnnualPlanAmount)
.reduce(BigDecimal::add).orElse(BigDecimal.ZERO);

List<ProjectRenewalFundDeclaration> fundDeclarations = renewalMap.get(w.getId());
if (fundDeclarations != null) {
item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), fundDeclarations));
item.setAnnualAccumulateAmountList(convertAccmulate(w, fundDeclarations));
item.setAnnualAccumulateAmount(computeAmount(totalAnnualPaymentAmount, fundDeclarations));
item.setAnnualAccumulateAmountList(convertAccmulate(w, totalAnnualPaymentAmount, fundDeclarations));
} else {
item.setAnnualAccumulateAmount(w.getAnnualPlanAmount());
item.setAnnualAccumulateAmountList(convertAccmulate(w, Collections.emptyList()));
item.setAnnualAccumulateAmount(totalAnnualPaymentAmount);
item.setAnnualAccumulateAmountList(convertAccmulate(w, totalAnnualPaymentAmount, Collections.emptyList()));
}
return item;
});
@@ -193,10 +204,14 @@ public class ProjectLibManage {
return PageVo.empty();
}
UserFullInfoDTO finalUser = user;

Set<String> projectCodes = page.getRecords().stream()
.map(Project::getProjectCode).collect(Collectors.toSet());
Set<String> projectCodes = new HashSet<>();
List<Long> projectIds = new ArrayList<>();
for (Project project : page.getRecords()) {
projectIds.add(project.getId());
projectCodes.add(project.getProjectCode());
}
Map<String, List<TagVO>> projectTagMap = getProjectTags(projectCodes);
Map<Long, List<ProjectPaymentPlan>> paymentPlansMap = projectPaymentPlanService.listByProjectIds(projectIds);

Map<Long, List<ProjectRenewalFundDeclaration>> renewalMap = listRenewDeclarations(projectCodes);
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> {
@@ -223,16 +238,20 @@ public class ProjectLibManage {
item.setCanPreDeclared(Boolean.TRUE);
}
item.setApprovedAmount(w.getApprovalAmount());
item.setAnnualPlanAmount(w.getAnnualPlanAmount());
List<ProjectPaymentPlan> paymentPlans = paymentPlansMap.getOrDefault(w.getId(), Collections.emptyList());
BigDecimal totalAnnualPaymentAmount = paymentPlans.stream()
.map(ProjectPaymentPlan::getAnnualPlanAmount)
.reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
item.setAnnualPlanAmount(totalAnnualPaymentAmount);
item.setPrePlanProjectId(w.getPrePlanProjectId());
item.setTags(projectTagMap.get(w.getProjectCode()));
List<ProjectRenewalFundDeclaration> fundDeclarations = renewalMap.get(w.getId());
if (fundDeclarations != null) {
item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), fundDeclarations));
item.setAnnualAccumulateAmountList(convertAccmulate(w, fundDeclarations));
item.setAnnualAccumulateAmount(computeAmount(totalAnnualPaymentAmount, fundDeclarations));
item.setAnnualAccumulateAmountList(convertAccmulate(w, totalAnnualPaymentAmount, fundDeclarations));
} else {
item.setAnnualAccumulateAmount(w.getAnnualPlanAmount());
item.setAnnualAccumulateAmountList(convertAccmulate(w, Collections.emptyList()));
item.setAnnualAccumulateAmount(totalAnnualPaymentAmount);
item.setAnnualAccumulateAmountList(convertAccmulate(w, totalAnnualPaymentAmount, Collections.emptyList()));
}
return item;
});
@@ -298,7 +317,7 @@ public class ProjectLibManage {
item.setCanPreDeclared(Boolean.TRUE);
}
item.setApprovedAmount(w.getApprovalAmount());
item.setAnnualPlanAmount(w.getAnnualPlanAmount());
// item.setAnnualPlanAmount(w.getAnnualPlanAmount());
item.setPrePlanProjectId(w.getPrePlanProjectId());
records.add(item);
}
@@ -572,12 +591,12 @@ public class ProjectLibManage {
return annualAmounts;
}

public static List<AnnualAmountVO> convertAccmulate(Project project, List<ProjectRenewalFundDeclaration> prfs) {
public static List<AnnualAmountVO> convertAccmulate(Project project, BigDecimal totalAnnualPlanAmount, List<ProjectRenewalFundDeclaration> prfs) {
List<AnnualAmountVO> annualAmounts = Lists.newArrayList();
annualAmounts.add(AnnualAmountVO.builder()
.projectId(project.getId())
.projectYear(project.getProjectYear())
.annualAmount(project.getAnnualPlanAmount())
.annualAmount(totalAnnualPlanAmount)
.build());
for (ProjectRenewalFundDeclaration prf : prfs) {
annualAmounts.add(AnnualAmountVO.builder()
@@ -719,11 +738,15 @@ public class ProjectLibManage {

//查询年度投资金额 要是已验收的项目
if (ProjectStatusEnum.ACCEPTED.getCode().equals(projectInfo.getStatus())) {
List<ProjectPaymentPlan> paymentPlans = projectPaymentPlanService.listByProjectId(projectInfo.getId());
BigDecimal totalAnnualAmount = paymentPlans.stream()
.map(ProjectPaymentPlan::getAnnualPlanAmount)
.reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
List<AnnualAmountVO> annualAmounts = Lists.newArrayList();
annualAmounts.add(AnnualAmountVO.builder()
.projectId(projectInfo.getId())
.projectYear(projectInfo.getProjectYear())
.annualAmount(projectInfo.getAnnualPlanAmount())
.annualAmount(totalAnnualAmount)
.build());
List<ProjectRenewalFundDeclaration> renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class)
.eq(ProjectRenewalFundDeclaration::getProjectId, vo.getId())


+ 29
- 9
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java View File

@@ -9,6 +9,8 @@ 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.hz.pm.api.projectlib.model.entity.ProjectPaymentPlan;
import com.hz.pm.api.projectlib.service.IProjectPaymentPlanService;
import com.hz.pm.api.user.security.model.UserInfoDetails;
import com.hz.pm.api.user.util.LoginUserUtil;
import com.ningdatech.basic.exception.BizException;
@@ -91,9 +93,8 @@ public class ProjectRenewalFundManage {

private final IGovBizProjectApproveService approveService;

private final RegionCacheHelper regionCacheHelper;

private final IPaymentPlanService paymentPlanService;
private final IProjectPaymentPlanService projectPaymentPlanService;

/**
* 项目续建资金库列表 分页
@@ -131,7 +132,14 @@ public class ProjectRenewalFundManage {
return PageVo.empty();
}

List<String> projectCodes = CollUtils.fieldList(page.getRecords(), Project::getProjectCode);
Set<String> projectCodes = new HashSet<>();
List<Long> projectIds = new ArrayList<>();
for (Project project : page.getRecords()) {
projectIds.add(project.getId());
projectCodes.add(project.getProjectCode());
}

Map<Long, List<ProjectPaymentPlan>> paymentPlansMap = projectPaymentPlanService.listByProjectIds(projectIds);

Map<Long, List<ProjectRenewalFundDeclaration>> renewalMap;
if (CollUtil.isNotEmpty(projectCodes)) {
@@ -172,15 +180,20 @@ public class ProjectRenewalFundManage {
item.setCanPreDeclared(Boolean.TRUE);
}
item.setApprovedAmount(w.getApprovalAmount());
item.setAnnualPlanAmount(w.getAnnualPlanAmount());
List<ProjectPaymentPlan> paymentPlans = paymentPlansMap.getOrDefault(w.getId(), Collections.emptyList());
BigDecimal totalAnnualPaymentAmount = paymentPlans.stream()
.map(ProjectPaymentPlan::getAnnualPlanAmount)
.reduce(BigDecimal::add).orElse(BigDecimal.ZERO);

item.setAnnualPlanAmount(totalAnnualPaymentAmount);
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));
item.setAnnualAccumulateAmount(ProjectLibManage.computeAmount(totalAnnualPaymentAmount, prfs));
item.setAnnualAccumulateAmountList(ProjectLibManage.convertAccmulate(w, totalAnnualPaymentAmount, prfs));
} else {
item.setAnnualAccumulateAmount(w.getAnnualPlanAmount());
item.setAnnualAccumulateAmountList(ProjectLibManage.convertAccmulate(w, Collections.emptyList()));
item.setAnnualAccumulateAmount(totalAnnualPaymentAmount);
item.setAnnualAccumulateAmountList(ProjectLibManage.convertAccmulate(w, totalAnnualPaymentAmount, Collections.emptyList()));
}
return item;
});
@@ -223,11 +236,18 @@ public class ProjectRenewalFundManage {
vo.setBuildOrgName(project.getBuildOrgName());
vo.setAnnualPaymentAmount(renewal.getAnnualPaymentAmount());
List<AnnualAmountVO> annualAmounts = Lists.newArrayList();

List<ProjectPaymentPlan> paymentPlans = projectPaymentPlanService.listByProjectId(project.getId());

BigDecimal totalAnnualPaymentAmount = paymentPlans.stream()
.map(ProjectPaymentPlan::getAnnualPlanAmount)
.reduce(BigDecimal::add).orElse(BigDecimal.ZERO);

annualAmounts.add(AnnualAmountVO.builder()
.projectId(project.getId())
.projectCode(project.getProjectCode())
.projectYear(project.getProjectYear())
.annualAmount(project.getAnnualPlanAmount())
.annualAmount(totalAnnualPaymentAmount)
.build());
List<ProjectRenewalFundDeclaration> renewalDeclarations = projectRenewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class)
.eq(ProjectRenewalFundDeclaration::getProjectId, vo.getProjectId())


+ 0
- 4
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.xml View File

@@ -18,7 +18,6 @@
approval_amount,
stage,
status,
annual_plan_amount,
biz_domain,
inst_code,
is_higher_super_org,
@@ -41,7 +40,6 @@
approval_amount,
stage,
status,
annual_plan_amount,
biz_domain,
inst_code,
is_higher_super_org,
@@ -297,7 +295,6 @@
approval_amount,
stage,
status,
annual_plan_amount,
biz_domain,
inst_code,
is_higher_super_org,
@@ -320,7 +317,6 @@
approval_amount,
stage,
status,
annual_plan_amount,
biz_domain,
inst_code,
is_higher_super_org,


+ 3
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectDTO.java View File

@@ -334,6 +334,9 @@ public class ProjectDTO implements Serializable {
@ApiModelProperty("可研报告")
private String baseResearchReportFile;

@ApiModelProperty("可研批复文件")
private String baseResearchReportApprovalFile;

@ApiModelProperty("其他附件")
private String baseProjOtherFile;



+ 3
- 24
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/Project.java View File

@@ -209,30 +209,6 @@ public class Project implements Serializable {
@Compare("资金分配情况-第三方服务")
private BigDecimal thirdPartyAmount;

@ApiModelProperty("年度支付计划-年度支付计划(万元)")
@Compare("年度支付计划-年度支付计划")
private BigDecimal annualPlanAmount;

@ApiModelProperty("年度支付计划-自有金额(万元)")
@Compare("年度支付计划-自有金额")
private BigDecimal annualPlanHaveAmount;

@ApiModelProperty("年度支付计划-政府投资-本级财政资金(万元)")
@Compare("年度支付计划-政府投资-本级财政资金")
private BigDecimal annualPlanGovOwnFinanceAmount;

@ApiModelProperty("年度支付计划-政府投资-上级补助资金(万元)")
@Compare("年度支付计划-政府投资-上级补助资金")
private BigDecimal annualPlanGovSuperiorFinanceAmount;

@ApiModelProperty("年度支付计划-银行贷款(万元)")
@Compare("年度支付计划-银行贷款")
private BigDecimal annualPlanBankLendingAmount;

@ApiModelProperty("年度支付计划-其它资金(万元)")
@Compare("年度支付计划-其它资金")
private BigDecimal annualPlanOtherAmount;

@ApiModelProperty("立项批复总投资(万元)")
@Compare("立项批复总投资")
private BigDecimal approvalAmount;
@@ -535,6 +511,9 @@ public class Project implements Serializable {
@ApiModelProperty("可研报告")
private String baseResearchReportFile;

@ApiModelProperty("可研批复文件")
private String baseResearchReportApprovalFile;

@ApiModelProperty("其他附件")
private String baseProjOtherFile;



+ 2
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectPaymentPlan.java View File

@@ -39,6 +39,8 @@ public class ProjectPaymentPlan implements Serializable {

private BigDecimal annualPlanGovSuperiorFinanceAmount;

private Long projectId;

@ApiModelProperty("项目编码")
private String projectCode;



+ 23
- 3
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectPaymentPlanService.java View File

@@ -1,13 +1,19 @@
package com.hz.pm.api.projectlib.service;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.projectlib.model.entity.ProjectApplication;
import com.hz.pm.api.projectlib.model.entity.ProjectPaymentPlan;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hz.pm.api.projectlib.model.entity.ProjectPaymentPlan;
import com.ningdatech.basic.util.CollUtils;

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

/**
* <p>
* 服务类
* 服务类
* </p>
*
* @author WendyYang
@@ -21,4 +27,18 @@ public interface IProjectPaymentPlanService extends IService<ProjectPaymentPlan>
.eq(ProjectPaymentPlan::getProjectVersion, projectVersion));
}

default Map<Long, List<ProjectPaymentPlan>> listByProjectIds(Collection<Long> projectIds) {
LambdaQueryWrapper<ProjectPaymentPlan> query = Wrappers.lambdaQuery(ProjectPaymentPlan.class)
.in(ProjectPaymentPlan::getProjectId, projectIds)
.orderByAsc(ProjectPaymentPlan::getPaymentYear);
return CollUtils.group(list(query), ProjectPaymentPlan::getProjectId);
}

default List<ProjectPaymentPlan> listByProjectId(Long projectId) {
LambdaQueryWrapper<ProjectPaymentPlan> query = Wrappers.lambdaQuery(ProjectPaymentPlan.class)
.eq(ProjectPaymentPlan::getProjectId, projectId)
.orderByAsc(ProjectPaymentPlan::getPaymentYear);
return list(query);
}

}

+ 2
- 2
hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java View File

@@ -1414,8 +1414,8 @@ public class TodoCenterManage {
paramsMap.put("cloudType", cloudTypeName);
}
// 获取本年计划投资金额
BigDecimal yearPlanInvest = project.getAnnualPlanAmount();
paramsMap.put("yearPlanInvest", yearPlanInvest);
// BigDecimal yearPlanInvest = project.getAnnualPlanAmount();
paramsMap.put("yearPlanInvest", BigDecimal.ZERO);
// 根据地区编码获取当地大数据局(中心)的名称
paramsMap.put("bigDataBureauName", null);
// 备注模块如果为空


Loading…
Cancel
Save