From 90d7e4e01dd98cbc85ce1473e75d433aed0a3aab Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Wed, 27 Sep 2023 15:20:20 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=94=B3=E6=8A=A5=E5=92=8C?= =?UTF-8?q?=E5=BD=92=E9=9B=86=20=E7=9A=84=E5=B9=B6=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/projectlib/manage/ProjectLibManage.java | 2 ++ .../manage/ProjectRenewalFundManage.java | 39 ++++++++++++++++------ .../projectCollection/ProjectCollection2Test.java | 2 +- 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index 635adbe..441a904 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -319,6 +319,7 @@ public class ProjectLibManage { List records = CollUtils.convert(page.getRecords(), w -> { ProjectLibListItemVO item = new ProjectLibListItemVO(); item.setId(w.getId()); + item.setFromType(w.getFromType()); item.setProjectName(w.getProjectName()); item.setProjectCode(w.getProjectCode()); item.setArea(w.getArea()); @@ -400,6 +401,7 @@ public class ProjectLibManage { List records = CollUtils.convert(page.getRecords(), w -> { ProjectLibListItemVO item = new ProjectLibListItemVO(); item.setId(w.getId()); + item.setFromType(w.getFromType()); item.setProjectName(w.getProjectName()); item.setProjectCode(w.getProjectCode()); item.setArea(w.getArea()); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java index 6614ee9..282f1d9 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java @@ -14,6 +14,10 @@ import com.ningdatech.pmapi.common.constant.BizConst; import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.common.util.ExcelDownUtil; import com.ningdatech.pmapi.common.util.ExcelExportStyle; +import com.ningdatech.pmapi.gov.model.entity.GovBizProjectApply; +import com.ningdatech.pmapi.gov.model.entity.GovBizProjectBaseinfo; +import com.ningdatech.pmapi.gov.service.IGovBizProjectApplyService; +import com.ningdatech.pmapi.gov.service.IGovBizProjectBaseinfoService; import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectRenewalDeclareExportDTO; import com.ningdatech.pmapi.projectlib.enumeration.ProjectRenewalApprovalStatusEnum; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; @@ -33,6 +37,7 @@ import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; import com.ningdatech.pmapi.user.util.LoginUserUtil; import com.wflow.exception.BusinessException; import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; @@ -60,6 +65,10 @@ public class ProjectRenewalFundManage { private final IProjectService projectService; + private final IGovBizProjectBaseinfoService baseinfoService; + + private final IGovBizProjectApplyService applyService; + /** * 项目续建资金库列表 分页 * @param req @@ -138,12 +147,16 @@ public class ProjectRenewalFundManage { */ public Long declared(ProjectRenewalFundDeclarationDTO dto) { //要判断 项目id 是否 以及状态是 已验收 - Long projectId = dto.getProjectId(); - Project project = projectService.getById(projectId); - VUtils.isTrue(Objects.isNull(project)).throwMessage(String.format("关联的项目【%s】不存在 提交失败!",projectId)); - VUtils.isTrue(!ProjectStatusEnum.ACCEPTED.getCode().equals(project.getStatus()) || - !ProjectStatusEnum.ARCHIVED.getCode().equals(project.getStage())) - .throwMessage("提交失败 该项目不是 已验收状态或者已归档阶段"); + String projectCode = dto.getProjectCode(); + Project project = projectService.getProjectByCode(projectCode); + GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getBaseProjId, projectCode) + .last(BizConst.LIMIT_1)); + GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) + .eq(GovBizProjectApply::getBaseProjId, projectCode) + .last(BizConst.LIMIT_1)); + + VUtils.isTrue(Objects.isNull(project) && Objects.isNull(baseinfo)).throwMessage(String.format("关联的项目【%s】不存在 提交失败!",projectCode)); ProjectRenewalFundDeclaration declaration = new ProjectRenewalFundDeclaration(); //如果是重新申报 if(Objects.nonNull(dto.getId())){ @@ -159,21 +172,27 @@ public class ProjectRenewalFundManage { //有2个条件要判断 续建资金 //1. 如果有审核中的 是不能继续申请的 long pendingCount = projectRenewalFundDeclarationService.count(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) - .eq(ProjectRenewalFundDeclaration::getProjectId, projectId) + .eq(ProjectRenewalFundDeclaration::getProjectCode, projectCode) .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PENDING.name())); VUtils.isTrue(pendingCount > 0L).throwMessage("当前有在审核的续建项目 不能再申请了"); //2.是要当前最新资金的下年度 才能申请 VUtils.isTrue(Objects.isNull(dto.getProjectYear())).throwMessage("新建的续建项目信息 年度不能为空"); ProjectRenewalFundDeclaration lastRenewalFund = projectRenewalFundDeclarationService.getOne(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) - .eq(ProjectRenewalFundDeclaration::getProjectId, projectId) + .eq(ProjectRenewalFundDeclaration::getProjectCode, projectCode) .eq(ProjectRenewalFundDeclaration::getApprovalStatus,ProjectRenewalApprovalStatusEnum.PASS.name()) .orderByDesc(ProjectRenewalFundDeclaration::getProjectYear) .last(BizConst.LIMIT_1)); //如果没有续建资金信息 就要比 当前项目的年度要大 if(Objects.isNull(lastRenewalFund)){ - VUtils.isTrue(project.getProjectYear() >= dto.getProjectYear()) - .throwMessage("续建资金年度错误!"); + if(Objects.nonNull(project)){ + VUtils.isTrue(project.getProjectYear() >= dto.getProjectYear()) + .throwMessage("续建资金年度错误!"); + }else if(Objects.nonNull(apply)){ + VUtils.isTrue(StringUtils.isBlank(apply.getBaseProjSetYear()) || + Integer.parseInt(apply.getBaseProjSetYear()) >= dto.getProjectYear()) + .throwMessage("续建资金年度错误!"); + } }else{ VUtils.isTrue(lastRenewalFund.getProjectYear() >= dto.getProjectYear()) .throwMessage("续建资金年度错误!"); diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollection2Test.java b/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollection2Test.java index 2464e26..076c2a2 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollection2Test.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollection2Test.java @@ -132,7 +132,7 @@ public class ProjectCollection2Test extends AppTests { @Test public void test2(){ //恢复误删 - String baseProjId = "33110000020210100116"; + String baseProjId = "33110000020210100149"; baseinfoService.update(Wrappers.lambdaUpdate(GovBizProjectBaseinfo.class) .eq(GovBizProjectBaseinfo::getBaseProjId,baseProjId)