diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectRenewalFundDeclarationController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectRenewalFundDeclarationController.java index 0313d41..677115d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectRenewalFundDeclarationController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectRenewalFundDeclarationController.java @@ -2,6 +2,7 @@ package com.ningdatech.pmapi.projectlib.controller; import com.ningdatech.basic.model.PageVo; +import com.ningdatech.pmapi.common.util.ExcelDownUtil; import com.ningdatech.pmapi.projectlib.manage.ProjectRenewalFundManage; import com.ningdatech.pmapi.projectlib.model.dto.ProjectRenewalFundDeclarationDTO; import com.ningdatech.pmapi.projectlib.model.req.ProjectRenewalAuditReq; @@ -13,6 +14,8 @@ import lombok.AllArgsConstructor; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; + /** *
* 续建项目资金申请表 前端控制器 @@ -52,4 +55,16 @@ public class ProjectRenewalFundDeclarationController { return projectRenewalFundManage.audit(param); } + @DeleteMapping("/delete/{projectRenewalId}") + @ApiOperation("续建项目删除") + private Long delete(@PathVariable("projectRenewalId") Long projectRenewalId){ + return projectRenewalFundManage.delete(projectRenewalId); + } + + @GetMapping("/export") + @ApiOperation("续建项目列表导出") + private void exportList(ProjectRenewalListReq req, HttpServletResponse response){ + ExcelDownUtil.downXls(response,req,projectRenewalFundManage::exportList); + } + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectRenewalApprovalStatusEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectRenewalApprovalStatusEnum.java index 6a4ab6a..27a38ed 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectRenewalApprovalStatusEnum.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectRenewalApprovalStatusEnum.java @@ -1,6 +1,13 @@ package com.ningdatech.pmapi.projectlib.enumeration; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + /** *
* ProjectRenewalApprovalStatusEnum @@ -9,6 +16,9 @@ package com.ningdatech.pmapi.projectlib.enumeration; * @author Poffy * @since 16:54 2023/2/11 */ +@Getter +@AllArgsConstructor +@NoArgsConstructor public enum ProjectRenewalApprovalStatusEnum { /** * 续建项目 审核状态 @@ -16,8 +26,23 @@ public enum ProjectRenewalApprovalStatusEnum { * 通过 * 不通过 */ - PENDING, - PASS, - NOT_PASS; + PENDING(1,"审核中"), + PASS(2,"通过"), + NOT_PASS(3,"不通过"); + + private Integer code; + private String desc; + + public static String getDescByCode(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (ProjectRenewalApprovalStatusEnum t : ProjectRenewalApprovalStatusEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } } 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 a2521bd..ce45daa 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 @@ -1,11 +1,20 @@ package com.ningdatech.pmapi.projectlib.manage; +import cn.hutool.core.util.StrUtil; +import com.alibaba.excel.EasyExcel; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.pmapi.common.constant.CommonConstant; +import com.ningdatech.pmapi.common.util.ExcelDownUtil; +import com.ningdatech.pmapi.common.util.ExcelExportStyle; import com.ningdatech.pmapi.projectlib.enumeration.ProjectRenewalApprovalStatusEnum; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; +import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; +import com.ningdatech.pmapi.projectlib.model.dto.ProjectRenewalExportDTO; import com.ningdatech.pmapi.projectlib.model.dto.ProjectRenewalFundDeclarationDTO; import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration; @@ -20,9 +29,12 @@ import lombok.RequiredArgsConstructor; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.time.LocalDateTime; import java.util.List; import java.util.Objects; +import java.util.stream.Collectors; /** *
@@ -117,15 +129,78 @@ public class ProjectRenewalFundManage {
return declaration.getId();
}
+ /**
+ * 续建项目审核
+ * @param param
+ * @return
+ */
public Long audit(ProjectRenewalAuditReq param) {
Long projectRenewalId = param.getProjectRenewalId();
ProjectRenewalFundDeclaration projectRenewal = projectRenewalFundDeclarationService.getById(projectRenewalId);
if (Boolean.TRUE.equals(param.getResult())){
projectRenewal.setApprovalStatus(ProjectRenewalApprovalStatusEnum.PASS.name());
}else {
+ String auditOpinion = param.getAuditOpinion();
+ if (StrUtil.isBlank(auditOpinion)){
+ throw new BizException("审核意见不能为空");
+ }
+ projectRenewal.setAuditOpinion(auditOpinion);
projectRenewal.setApprovalStatus(ProjectRenewalApprovalStatusEnum.NOT_PASS.name());
}
- // projectRenewal
- return null;
+ projectRenewal.setUpdateOn(LocalDateTime.now());
+ projectRenewalFundDeclarationService.updateById(projectRenewal);
+ return projectRenewal.getId();
+ }
+
+ /**
+ * 续建项目删除
+ * @param projectRenewalId
+ * @return
+ */
+ public Long delete(Long projectRenewalId) {
+ ProjectRenewalFundDeclaration projectRenewal = projectRenewalFundDeclarationService.getById(projectRenewalId);
+ projectRenewal.setDeleted(true);
+ projectRenewal.setUpdateOn(LocalDateTime.now());
+ projectRenewalFundDeclarationService.updateById(projectRenewal);
+ return projectRenewal.getId();
+ }
+
+ public void exportList(HttpServletResponse response, ProjectRenewalListReq param) {
+
+ param.setPageNumber(CommonConstant.EXPORT_PAGE_NUMBER);
+ param.setPageSize(CommonConstant.EXPORT_PAGE_SIZE);
+ Page