diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java index 36fb01a..9ab0550 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java @@ -45,6 +45,7 @@ import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.math.BigDecimal; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -209,7 +210,13 @@ public class ConstructionManage { if(CollUtil.isEmpty(payments)){ return Collections.emptyList(); } - return payments.stream().map(p -> BeanUtil.copyProperties(p,PaymentPlanVO.class)) + return payments.stream().map(p -> { + PaymentPlanVO vo = BeanUtil.copyProperties(p, PaymentPlanVO.class); + vo.setRatio((Objects.isNull(p.getPlanAmount())||p.getPlanAmount().compareTo(BigDecimal.ZERO) == 0) ? "0%" + : p.getPaymentAmount().multiply(BigDecimal.valueOf(100)) + .divide(p.getPlanAmount(),BigDecimal.ROUND_CEILING,BigDecimal.ROUND_CEILING) + "%"); + return vo; + }) .collect(Collectors.toList()); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/PaymentPlanVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/PaymentPlanVO.java index 5e3d08b..130c3e8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/PaymentPlanVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/PaymentPlanVO.java @@ -47,6 +47,9 @@ public class PaymentPlanVO { @ApiModelProperty("支付金额") private BigDecimal paymentAmount; + @ApiModelProperty("支付比例") + private String ratio; + @ApiModelProperty("支付时间") @JsonFormat(pattern = "yyyy-MM-dd") private LocalDateTime paymentTime;