|
@@ -14,6 +14,10 @@ import com.ningdatech.pmapi.common.constant.BizConst; |
|
|
import com.ningdatech.pmapi.common.constant.CommonConst; |
|
|
import com.ningdatech.pmapi.common.constant.CommonConst; |
|
|
import com.ningdatech.pmapi.common.util.ExcelDownUtil; |
|
|
import com.ningdatech.pmapi.common.util.ExcelDownUtil; |
|
|
import com.ningdatech.pmapi.common.util.ExcelExportStyle; |
|
|
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.projectdeclared.model.dto.ProjectRenewalDeclareExportDTO; |
|
|
import com.ningdatech.pmapi.projectlib.enumeration.ProjectRenewalApprovalStatusEnum; |
|
|
import com.ningdatech.pmapi.projectlib.enumeration.ProjectRenewalApprovalStatusEnum; |
|
|
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; |
|
|
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.ningdatech.pmapi.user.util.LoginUserUtil; |
|
|
import com.wflow.exception.BusinessException; |
|
|
import com.wflow.exception.BusinessException; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.springframework.beans.BeanUtils; |
|
|
import org.springframework.beans.BeanUtils; |
|
|
import org.springframework.stereotype.Component; |
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
@@ -60,6 +65,10 @@ public class ProjectRenewalFundManage { |
|
|
|
|
|
|
|
|
private final IProjectService projectService; |
|
|
private final IProjectService projectService; |
|
|
|
|
|
|
|
|
|
|
|
private final IGovBizProjectBaseinfoService baseinfoService; |
|
|
|
|
|
|
|
|
|
|
|
private final IGovBizProjectApplyService applyService; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 项目续建资金库列表 分页 |
|
|
* 项目续建资金库列表 分页 |
|
|
* @param req |
|
|
* @param req |
|
@@ -138,12 +147,16 @@ public class ProjectRenewalFundManage { |
|
|
*/ |
|
|
*/ |
|
|
public Long declared(ProjectRenewalFundDeclarationDTO dto) { |
|
|
public Long declared(ProjectRenewalFundDeclarationDTO dto) { |
|
|
//要判断 项目id 是否 以及状态是 已验收 |
|
|
//要判断 项目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(); |
|
|
ProjectRenewalFundDeclaration declaration = new ProjectRenewalFundDeclaration(); |
|
|
//如果是重新申报 |
|
|
//如果是重新申报 |
|
|
if(Objects.nonNull(dto.getId())){ |
|
|
if(Objects.nonNull(dto.getId())){ |
|
@@ -159,21 +172,27 @@ public class ProjectRenewalFundManage { |
|
|
//有2个条件要判断 续建资金 |
|
|
//有2个条件要判断 续建资金 |
|
|
//1. 如果有审核中的 是不能继续申请的 |
|
|
//1. 如果有审核中的 是不能继续申请的 |
|
|
long pendingCount = projectRenewalFundDeclarationService.count(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) |
|
|
long pendingCount = projectRenewalFundDeclarationService.count(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) |
|
|
.eq(ProjectRenewalFundDeclaration::getProjectId, projectId) |
|
|
|
|
|
|
|
|
.eq(ProjectRenewalFundDeclaration::getProjectCode, projectCode) |
|
|
.eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PENDING.name())); |
|
|
.eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PENDING.name())); |
|
|
VUtils.isTrue(pendingCount > 0L).throwMessage("当前有在审核的续建项目 不能再申请了"); |
|
|
VUtils.isTrue(pendingCount > 0L).throwMessage("当前有在审核的续建项目 不能再申请了"); |
|
|
|
|
|
|
|
|
//2.是要当前最新资金的下年度 才能申请 |
|
|
//2.是要当前最新资金的下年度 才能申请 |
|
|
VUtils.isTrue(Objects.isNull(dto.getProjectYear())).throwMessage("新建的续建项目信息 年度不能为空"); |
|
|
VUtils.isTrue(Objects.isNull(dto.getProjectYear())).throwMessage("新建的续建项目信息 年度不能为空"); |
|
|
ProjectRenewalFundDeclaration lastRenewalFund = projectRenewalFundDeclarationService.getOne(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) |
|
|
ProjectRenewalFundDeclaration lastRenewalFund = projectRenewalFundDeclarationService.getOne(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) |
|
|
.eq(ProjectRenewalFundDeclaration::getProjectId, projectId) |
|
|
|
|
|
|
|
|
.eq(ProjectRenewalFundDeclaration::getProjectCode, projectCode) |
|
|
.eq(ProjectRenewalFundDeclaration::getApprovalStatus,ProjectRenewalApprovalStatusEnum.PASS.name()) |
|
|
.eq(ProjectRenewalFundDeclaration::getApprovalStatus,ProjectRenewalApprovalStatusEnum.PASS.name()) |
|
|
.orderByDesc(ProjectRenewalFundDeclaration::getProjectYear) |
|
|
.orderByDesc(ProjectRenewalFundDeclaration::getProjectYear) |
|
|
.last(BizConst.LIMIT_1)); |
|
|
.last(BizConst.LIMIT_1)); |
|
|
//如果没有续建资金信息 就要比 当前项目的年度要大 |
|
|
//如果没有续建资金信息 就要比 当前项目的年度要大 |
|
|
if(Objects.isNull(lastRenewalFund)){ |
|
|
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{ |
|
|
}else{ |
|
|
VUtils.isTrue(lastRenewalFund.getProjectYear() >= dto.getProjectYear()) |
|
|
VUtils.isTrue(lastRenewalFund.getProjectYear() >= dto.getProjectYear()) |
|
|
.throwMessage("续建资金年度错误!"); |
|
|
.throwMessage("续建资金年度错误!"); |
|
|