diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java index 734c9c8..927e682 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java @@ -32,6 +32,7 @@ public interface CommonConst { String ARCHIVED = "归档"; String FILE_NAME = "name"; + String BASIS_FILE_NAME = "fileName"; String NULL = "null"; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java index e44bd93..02ab1a7 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java @@ -44,7 +44,7 @@ public class ProjectDeclareAction { } @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") - public void UNDER_INTERNAL_RESUBMIT(Message message) { + public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); } @@ -99,6 +99,12 @@ public class ProjectDeclareAction { project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); } + @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") + public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + } + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") public void PRE_APPLYING_WITHDRAW(Message message) { Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); @@ -174,6 +180,12 @@ public class ProjectDeclareAction { project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); } + @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") + public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineBuilder.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineBuilder.java index 4cffea8..07ce7e4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineBuilder.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineBuilder.java @@ -86,7 +86,7 @@ public class ProjectDeclareStateMachineBuilder { .withExternal() .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .event(ProjectStatusChangeEvent.PROJECT_APPLICATION_SUBMIT).and() + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() // 待预审预审申报,从待预审到待预审选择 .withExternal() @@ -145,7 +145,7 @@ public class ProjectDeclareStateMachineBuilder { .withExternal() .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 .withChoice() .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) @@ -200,7 +200,7 @@ public class ProjectDeclareStateMachineBuilder { .withExternal() .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() + .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() // 待立项批复批复,从待立项批复到待采购 .withExternal() .source(ProjectStatusEnum.TO_BE_APPROVED) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/event/ProjectStatusChangeEvent.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/event/ProjectStatusChangeEvent.java index 1d7bbeb..96121f8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/event/ProjectStatusChangeEvent.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/event/ProjectStatusChangeEvent.java @@ -36,6 +36,11 @@ public enum ProjectStatusChangeEvent { */ UNDER_INTERNAL_PASS(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode(), null, null), /** + * 单位内部审核不通过重新提交(项目状态进入:单位内部审核中) + */ + UNDER_INTERNAL_REJECT_RESUBMIT(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(),null,null), + + /** * 预审申报(项目状态进入:待预审选择,有判断条件:市级项目且申报金额大于1000万项目状态变为:省级部门联审中;否则项目状态变为:预审中) */ PRELIMINARY_REVIEW_DECLARE(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode(), null, null), @@ -57,6 +62,10 @@ public enum ProjectStatusChangeEvent { */ PRELIMINARY_REVIEW_REJECT(null, ProjectStatusEnum.PRE_APPLYING.getCode(), null), /** + * 预审不通过重新提交(项目状态变为:待预审选择) + */ + PRELIMINARY_REVIEW_REJECT_RESUBMIT(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(),null,null), + /** * 预审通过(项目状态变为:部门联审中) */ PRELIMINARY_REVIEW_PASS(ProjectStatusEnum.PRE_APPLYING.getCode(), null, null), @@ -85,6 +94,10 @@ public enum ProjectStatusChangeEvent { */ PLAN_REVIEW_REJECT(null, ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode(), null), /** + * 方案评审不通过重新提交(项目状态变为:方案评审中) + */ + PLAN_REVIEW_REJECT_RESUBMIT(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode(),null,null), + /** * 方案评审通过(项目状态变为:待立项批复) */ PLAN_REVIEW_PASS(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode(), null, null), diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java index 82d6c42..b20de90 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java @@ -6,6 +6,8 @@ import cn.afterturn.easypoi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.TemplateExportParams; import cn.hutool.core.bean.BeanUtil; import cn.hutool.poi.excel.ExcelUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -13,6 +15,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.basic.util.StrPool; import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.common.enumeration.CommonEnum; import com.ningdatech.pmapi.common.helper.UserInfoHelper; @@ -26,6 +29,7 @@ import com.ningdatech.pmapi.projectlib.enumeration.ProjectLibFlagEnum; import com.ningdatech.pmapi.projectlib.enumeration.ProjectRenewalApprovalStatusEnum; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; +import com.ningdatech.pmapi.projectlib.model.dto.AnnualLibExportDTO; import com.ningdatech.pmapi.projectlib.model.dto.AnnualLibImportDTO; import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; import com.ningdatech.pmapi.projectlib.model.entity.Project; @@ -39,6 +43,7 @@ import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; import com.ningdatech.pmapi.projectlib.service.IProjectRenewalFundDeclarationService; import com.ningdatech.pmapi.projectlib.service.IProjectService; import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; +import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; import com.ningdatech.pmapi.user.util.LoginUserUtil; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -352,14 +357,36 @@ public class AnnualPlanLibManage { isTemporaryAugment = 1; fileName = "丽水市" + year + "年数字化项目年度计划增补库编辑表"; } - param.setIsTemporaryAugment(isTemporaryAugment); - param.setStatusList(CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode)); LambdaQueryWrapper query = ProjectHelper.projectQuery(param); + query.eq(Project::getIsTemporaryAugment, isTemporaryAugment); query.orderByDesc(Project::getAnnualPlanAddTime); + query.in(Project::getStatus, CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode)); + //数据权限 + buildProjectLibPermission(query); List projects = projectService.list(query); - List list = projects.stream().map(p -> { - AnnualLibImportDTO dto = new AnnualLibImportDTO(); + List list = projects.stream().map(p -> { + AnnualLibExportDTO dto = new AnnualLibExportDTO(); BeanUtils.copyProperties(p, dto); + String buildCycle = p.getBuildCycle(); + if (Objects.nonNull(buildCycle)) { + String cycle = buildCycle.replace(StrPool.TILDA, CommonConst.ZHI); + dto.setBuildCycle(cycle); + } + dto.setProjectId(p.getId()); + dto.setDeclaredAmount(p.getDeclareAmount()); + dto.setBuildUnitName(p.getBuildOrgName()); + String buildBasis = p.getBuildBasis(); + List fileArray = JSON.parseArray(buildBasis, JSONObject.class); + List nameList = CollUtils.fieldList(fileArray, w -> + w.getString(CommonConst.TITLE) + StrPool.LEFT_BRACKET + + w.getString(CommonConst.BASIS_FILE_NAME) + StrPool.RIGHT_BRACKET); + String basis = nameList.stream().collect(Collectors.joining(StrPool.COMMA)); + dto.setBuildBasis(basis); + if (CommonEnum.YES.getCode().equals(p.getIsFirst())){ + dto.setIsFirst(CommonConst.NEW_CONSTRUCTION); + }else if (CommonEnum.NO.getCode().equals(p.getIsFirst())){ + dto.setIsFirst(CommonConst.CONTINUED_CONSTRUCTION); + } dto.setFirstQuarter(p.getEngineeringSpeedOne()); dto.setSecondQuarter(p.getEngineeringSpeedTwo()); dto.setThirdQuarter(p.getEngineeringSpeedThree()); @@ -367,6 +394,12 @@ public class AnnualPlanLibManage { return dto; }).collect(Collectors.toList()); + int count = 0; + for (AnnualLibExportDTO annualLibExportDTO : list) { + count++; + annualLibExportDTO.setSerialNumber(count); + } + // 获取本地目录的年度计划编辑表Excel模板 File directory = new File(""); String templateName = "丽水市" + year + "年数字化项目年度计划编辑表"; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/AnnualLibExportDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/AnnualLibExportDTO.java new file mode 100644 index 0000000..7635e3f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/AnnualLibExportDTO.java @@ -0,0 +1,102 @@ +package com.ningdatech.pmapi.projectlib.model.dto; + +import java.math.BigDecimal; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +/** + *

+ * AnnualLibImportDTO + *

+ * + * @author WendyYang + * @since 13:46 2023/2/13 + */ +@Data +public class AnnualLibExportDTO { + + @NotNull(message = "年度投资额不能为空") + @Excel(name = "年度投资额",groupName = "2023年计划") + private BigDecimal annualPlanAmount; + + @NotNull(message = "自由资金不能为空") + @Excel(name = "自有资金",groupName = "资金来源") + private BigDecimal declareHaveAmount; + @Excel(name = "政府投资-本级财政资金") + @NotNull(message = "政府投资-本级财政不能为空") + private BigDecimal declareGovOwnFinanceAmount; + @Excel(name = "政府投资-上级补助资金") + @NotNull(message = "政府投资-上级补助资金不能为空") + private BigDecimal declareGovSuperiorFinanceAmount; + @Excel(name = "银行贷款") + @NotNull(message = "银行贷款不能为空") + private BigDecimal declareBankLendingAmount; + @Excel(name = "其他") + @NotNull(message = "其他不能为空") + private BigDecimal declareOtherAmount; + + @Excel(name = "一季度",groupName = "进度和支付计划") + @NotBlank(message = "一季度不能为空") + private String firstQuarter; + @Excel(name = "二季度") + @NotBlank(message = "二季度不能为空") + private String secondQuarter; + @Excel(name = "三季度") + @NotBlank(message = "三季度不能为空") + private String thirdQuarter; + @Excel(name = "四季度") + @NotBlank(message = "四季度不能为空") + private String fourthQuarter; + + @NotNull(message = "序号不能为空") + @Excel(name = "序号") + private Integer serialNumber; + + @Excel(name = "项目id") + @NotNull(message = "项目ID不能为空") + private Long projectId; + + @Excel(name = "项目名称") + @NotBlank(message = "项目名称不能为空") + private String projectName; + + @NotBlank(message = "建设内容不能为空") + @Excel(name = "建设内容") + private String projectIntroduction; + + @NotBlank(message = "建设依据不能为空") + @Excel(name = "建设依据") + private String buildBasis; + + @Excel(name = "建设性质") + @NotBlank(message = "建设性质不能为空") + private String isFirst; + + @Excel(name = "建设起止年限(填写到月)") + @NotBlank(message = "建设起止年限不能为空") + private String buildCycle; + + @NotBlank(message = "总投资不能为空") + @Excel(name = "总投资") + private BigDecimal declaredAmount; + + @Excel(name = "建设单位") + @NotBlank(message = "建设单位不能为空") + private String buildUnitName; + + @Excel(name = "项目联系人") + @NotBlank(message = "项目联系人不能为空") + private String contactName; + + @Excel(name = "项目分管领导") + @NotBlank(message = "项目分管领导不能为空") + private String responsibleMan; + + @Excel(name = "备注") + private String projectRemarks; + +}