From 5f7177576e98c56755ea2d42a4c3c87c06bf427f Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 17 Oct 2024 14:24:41 +0800 Subject: [PATCH] =?UTF-8?q?modify:=201.=20=E8=B5=84=E9=87=91=E4=B8=8B?= =?UTF-8?q?=E8=BE=BE=E5=A2=9E=E5=8A=A0=E7=BB=93=E8=BD=AC=E8=B5=84=E9=87=91?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hz/pm/api/projectlib/entity/ProjectApprovalAmount.java | 3 +++ .../com/hz/pm/api/projectlib/manage/AmountApprovalManage.java | 11 +++++++++-- .../pm/api/projectlib/model/dto/ProjectApprovalAmountDTO.java | 3 +++ .../pm/api/projectlib/model/req/SubmitAmountApprovalReq.java | 3 +++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/entity/ProjectApprovalAmount.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/entity/ProjectApprovalAmount.java index d5b2091..a6ed915 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/entity/ProjectApprovalAmount.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/entity/ProjectApprovalAmount.java @@ -30,6 +30,9 @@ public class ProjectApprovalAmount implements Serializable { @ApiModelProperty("下达资金") private BigDecimal approvalAmount; + @ApiModelProperty("上一年度结转资金") + private BigDecimal carryOverAmount; + @ApiModelProperty("年度") private Integer approvalYear; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AmountApprovalManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AmountApprovalManage.java index 9332ae3..4327b86 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AmountApprovalManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AmountApprovalManage.java @@ -166,6 +166,7 @@ public class AmountApprovalManage { return stat; } + @Transactional(rollbackFor = Exception.class) public synchronized void submitAmountApproval(SubmitAmountApprovalReq req) { Project project = projectService.getNewestNoNull(req.getProjectId()); if (ProjectStatus.STOPPED.eq(project.getStage()) @@ -181,6 +182,11 @@ public class AmountApprovalManage { if (approved && NumberUtil.isGreater(currTotalApprovalAmount, project.getReviewAmount())) { throw ReturnException.wrap("暂不允许下达资金"); } + ProjectApprovalAmount lastApprovalAmount = projectApprovalAmountService.getByProjectCode(project.getProjectCode()); + if (lastApprovalAmount != null && req.getCarryOverAmount() != null + && NumberUtil.isGreater(req.getCarryOverAmount(), lastApprovalAmount.getApprovalAmount())) { + throw ReturnException.wrap("结转资金不允许超过上一年度下达资金"); + } Wrapper wrapper = Wrappers.lambdaUpdate(Project.class) .set(StrUtil.isNotBlank(req.getApprovalAmountFile()), Project::getApprovalAmountFile, req.getApprovalAmountFile()) .set(Project::getApprovalAmount, currTotalApprovalAmount) @@ -195,6 +201,7 @@ public class AmountApprovalManage { projectApprovalAmount.setApprovalAmount(req.getApprovalAmount()); projectApprovalAmount.setProjectId(project.getId()); projectApprovalAmount.setProjectCode(project.getProjectCode()); + projectApprovalAmount.setCarryOverAmount(req.getApprovalAmount()); projectApprovalAmountService.save(projectApprovalAmount); projectService.update(wrapper); } @@ -211,7 +218,7 @@ public class AmountApprovalManage { } @Transactional(rollbackFor = Exception.class) - public synchronized void initOldApprovalAmount(){ + public synchronized void initOldApprovalAmount() { LambdaQueryWrapper query = Wrappers.lambdaQuery(Project.class) .gt(Project::getApprovalAmount, 0) .isNotNull(Project::getApprovalAmount) @@ -228,7 +235,7 @@ public class AmountApprovalManage { projectApprovalAmountService.saveBatch(approvalAmounts); } - public List listApprovalAmounts(String projectCode){ + public List listApprovalAmounts(String projectCode) { List approvalAmounts = projectApprovalAmountService.listByProjectCode(projectCode); return BeanUtil.copyToList(approvalAmounts, ProjectApprovalAmountDTO.class); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectApprovalAmountDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectApprovalAmountDTO.java index 98df642..21436b3 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectApprovalAmountDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectApprovalAmountDTO.java @@ -21,6 +21,9 @@ public class ProjectApprovalAmountDTO { @ApiModelProperty("下达资金") private BigDecimal approvalAmount; + @ApiModelProperty("结转金额") + private BigDecimal carryOverAmount; + @ApiModelProperty("年度") private Integer approvalYear; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/SubmitAmountApprovalReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/SubmitAmountApprovalReq.java index b6fe421..46996c6 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/SubmitAmountApprovalReq.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/SubmitAmountApprovalReq.java @@ -25,6 +25,9 @@ public class SubmitAmountApprovalReq { @NotNull(message = "批复金额不能为空") private BigDecimal approvalAmount; + @ApiModelProperty("上一年度结转金额") + private BigDecimal carryOverAmount; + @ApiModelProperty("评审总投资") private BigDecimal reviewAmount;