From d7fe81fabb36d799c17061840bf9964f0e14eb73 Mon Sep 17 00:00:00 2001 From: Harry Yang Date: Fri, 6 Jan 2023 10:24:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=9E=AB=E8=B5=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../work/model/process/ProcurementDetail.java | 7 ++++--- .../work/service/ProjectProcessService.java | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/main/java/cn/palmte/work/model/process/ProcurementDetail.java b/src/main/java/cn/palmte/work/model/process/ProcurementDetail.java index 5fdd965..a2859ad 100644 --- a/src/main/java/cn/palmte/work/model/process/ProcurementDetail.java +++ b/src/main/java/cn/palmte/work/model/process/ProcurementDetail.java @@ -28,7 +28,7 @@ public class ProcurementDetail { private String contractParty; - private int isUnderwritten; + private boolean isUnderwritten; private String isUnderwrittenDesc; private BigDecimal underwrittenAmount; @@ -60,8 +60,9 @@ public class ProcurementDetail { private Integer amountId; - public void setIsUnderwritten(int isUnderwritten) { + public void setIsUnderwritten(boolean isUnderwritten) { this.isUnderwritten = isUnderwritten; - this.isUnderwrittenDesc = isUnderwritten == 1 ? "是" : "否"; + this.isUnderwrittenDesc = isUnderwritten ? "是" : "否"; } + } diff --git a/src/main/java/cn/palmte/work/service/ProjectProcessService.java b/src/main/java/cn/palmte/work/service/ProjectProcessService.java index 30c5c41..1ea1034 100644 --- a/src/main/java/cn/palmte/work/service/ProjectProcessService.java +++ b/src/main/java/cn/palmte/work/service/ProjectProcessService.java @@ -296,7 +296,7 @@ public class ProjectProcessService { for (BudgetPurchaseAmount amount : purchaseAmount) { ProjectBudgetCostDetail costDetail = getCostDetailById(amount.getBudgetCostId()); ProcurementDetail detail = new ProcurementDetail(); - BeanUtils.copyProperties(costDetail, detail); + BeanUtils.copyProperties(costDetail, detail, "isUnderwritten"); Integer amountId = amount.getId(); // 找对应 预算采购明细的数量记录 的采购详情 @@ -314,6 +314,7 @@ public class ProjectProcessService { } detail.setAmountLeft(allAmount.subtract(amountAlready)); detail.setAmountCurrent(amount.getAmountCurrent()); + detail.setIsUnderwritten(isProjectPrepaid(projectId)); ret.add(detail); } } @@ -321,7 +322,7 @@ public class ProjectProcessService { List costDetails = getCostDetails(projectId); for (ProjectBudgetCostDetail costDetail : costDetails) { ProcurementDetail detail = new ProcurementDetail(); - BeanUtils.copyProperties(costDetail, detail); + BeanUtils.copyProperties(costDetail, detail, "isUnderwritten"); // 可能为 0 BigDecimal amountAlready = getAmountAlready(costDetail.getId()); detail.setAmountAlready(amountAlready); @@ -333,6 +334,7 @@ public class ProjectProcessService { // TODO 查询太频繁 detail.setCategory(getCategory(costDetail)); detail.setBudgetCostId(costDetail.getId()); + detail.setIsUnderwritten(isProjectPrepaid(projectId)); ret.add(detail); } } @@ -500,7 +502,14 @@ public class ProjectProcessService { * 是否垫资 */ public boolean isProjectPrepaid(Project project) { - return BigDecimal.ZERO.equals(getProjectRepaidAmount(project.getId())); + return isProjectPrepaid(project.getId()); + } + + /** + * 是否垫资 + */ + public boolean isProjectPrepaid(Integer projectId) { + return isProjectPrepaid(getProjectRepaidAmount(projectId)); } /**