Browse Source

Merge remote-tracking branch 'origin/master'

master
WendyYang 11 months ago
parent
commit
eb568b6aa5
3 changed files with 20 additions and 13 deletions
  1. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/ExportOptionEnum.java
  2. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java
  3. +17
    -10
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/ExportOptionEnum.java View File

@@ -69,7 +69,7 @@ public enum ExportOptionEnum {

projectIntroduction(24, "项目简介"),

baseBasis(25, "立项依据"),
buildBasis(25, "立项依据"),

buildLevel(26, "建设层级"),



+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java View File

@@ -44,7 +44,7 @@ public class ExcelDownUtil {
public static Map<String,String> convertMap = Maps.newHashMap();

static {
convertMap.put("baseBasis","baseBasisEstablish");
convertMap.put("buildBasis","baseBasisEstablish");
}

public static String encodeName(String name) {
@@ -234,7 +234,7 @@ public class ExcelDownUtil {
columnValue = jsonObject.getString(column.toString());
}
}
if (CommonConst.NULL.equals(columnValue)) {
if (Objects.isNull(columnValue) || CommonConst.NULL.equals(columnValue)) {
columnValue = "";
}
columnValues.add(columnValue);


+ 17
- 10
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java View File

@@ -396,7 +396,7 @@ public class ProjectRenewalFundManage {
}

//判断金额
checkPaymentAmount(projectCode,projectYear,dto.getAnnualPaymentAmount());
// checkPaymentAmount(projectCode,projectYear,dto.getAnnualPaymentAmount());

declaration.setApprovalStatus(ProjectRenewalApprovalStatusEnum.PENDING.name());
if(Objects.nonNull(project)){
@@ -443,17 +443,24 @@ public class ProjectRenewalFundManage {

//3. 算出 所能申报的最大金额
//3.1 算出 申报年 以及 之前的所有合同计划金额
Double planSum = paymentPlans.stream().filter(c -> Objects.nonNull(c.getPaymentTime()) &&
BigDecimal planSum = BigDecimal.ZERO;
Optional<BigDecimal> planSumOp = paymentPlans.stream().filter(c -> Objects.nonNull(c.getPaymentTime()) &&
(c.getPaymentTime().getYear() - projectYear) <= 0)
.mapToDouble(c -> Objects.nonNull(c.getPaymentAmount()) ? c.getPaymentAmount().doubleValue() : 0.0)
.sum();

Double actualPlanSum = paymentPlans.stream().filter(c -> Objects.nonNull(c.getPaymentTime()) &&
.map(c -> Objects.nonNull(c.getPaymentAmount()) ? c.getPaymentAmount() : BigDecimal.ZERO)
.reduce(BigDecimal::add);
if(planSumOp.isPresent()){
planSum = planSumOp.get();
}
BigDecimal actualPlanSum = BigDecimal.ZERO;
Optional<BigDecimal> actualPlanSumOp = paymentPlans.stream().filter(c -> Objects.nonNull(c.getPaymentTime()) &&
(c.getPaymentTime().getYear() - projectYear) < 0)
.mapToDouble(c -> Objects.nonNull(c.getActualPaymentAmount()) ? c.getActualPaymentAmount().doubleValue() : 0.0)
.sum();
Double maxAmount = planSum - actualPlanSum;
VUtils.isTrue(annualPlanAmount.compareTo(BigDecimal.valueOf(maxAmount)) > 0).throwMessage("所填年度支付金额 超出 最大限额");
.map(c -> Objects.nonNull(c.getActualPaymentAmount()) ? c.getActualPaymentAmount() : BigDecimal.ZERO)
.reduce(BigDecimal::add);
if(actualPlanSumOp.isPresent()){
actualPlanSum = actualPlanSumOp.get();
}
BigDecimal maxAmount = planSum.subtract(actualPlanSum);
VUtils.isTrue(annualPlanAmount.compareTo(maxAmount) > 0).throwMessage("所填年度支付金额 超出 最大限额");
}




Loading…
Cancel
Save