Selaa lähdekoodia

申报项目 关联用户ID和单位code

tags/24080901
PoffyZhang 1 vuosi sitten
vanhempi
commit
7be5479fc3
16 muutettua tiedostoa jossa 287 lisäystä ja 144 poistoa
  1. +1
    -9
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ConstructionPlanController.java
  2. +2
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java
  3. +1
    -9
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/PrequalificationDeclaredController.java
  4. +1
    -11
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ProjectAdjustmentController.java
  5. +32
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java
  6. +75
    -60
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java
  7. +32
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java
  8. +38
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ProjectAdjustmentManage.java
  9. +97
    -41
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java
  10. +0
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/DeclaredProjectListParamDTO.java
  11. +0
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/DefaultDeclaredDTO.java
  12. +1
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java
  13. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java
  14. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java
  15. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectListReq.java
  16. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java

+ 1
- 9
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ConstructionPlanController.java Näytä tiedosto

@@ -32,18 +32,10 @@ public class ConstructionPlanController {

private final ConstructionPlanManage constructionPlanManage;

private final ProjectLibManage projectLibManage;

@ApiOperation(value = "可申报建设方案项目列表", notes = "可申报建设方案项目列表")
@GetMapping("/list")
public PageVo<ProjectLibListItemVO> list(@Validated @ModelAttribute ConstrctionPlanListReq planReq) {
//限定参数 复制bean
ProjectListReq req = new ProjectListReq();
BeanUtils.copyProperties(planReq,req);
//项目阶段 状态 已定 方案待申报
req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
req.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode());
return projectLibManage.projectLibList(req);
return constructionPlanManage.projectLibList(planReq);
}

@ApiOperation(value = "建设方案申报", notes = "建设方案申报")


+ 2
- 4
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java Näytä tiedosto

@@ -31,12 +31,10 @@ import org.springframework.web.bind.annotation.*;
public class DeclaredProjectController {
private final DeclaredProjectManage declaredProjectManage;

private final ProjectLibManage projectLibManage;

@ApiOperation(value = "申报项目已申报列表", notes = "申报项目已申报列表")
@GetMapping("/list")
public PageVo<ProjectLibListItemVO> list(@ModelAttribute ProjectListReq req) {;
return projectLibManage.projectLibList(req);
public PageVo<ProjectLibListItemVO> list(@ModelAttribute ProjectListReq req) {
return declaredProjectManage.projectLibList(req);
}

@ApiOperation(value = "申报项目草稿箱列表", notes = "申报项目草稿箱列表")


+ 1
- 9
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/PrequalificationDeclaredController.java Näytä tiedosto

@@ -30,20 +30,12 @@ import org.springframework.web.bind.annotation.*;
@RequiredArgsConstructor
public class PrequalificationDeclaredController {

private final ProjectLibManage projectLibManage;

private final PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage;

@ApiOperation(value = "可预审申报项目列表", notes = "可预审申报项目列表")
@GetMapping("/list")
public PageVo<ProjectLibListItemVO> list(@Validated @ModelAttribute PrequalificationDeclaredListReq preReq) {
//限定参数 复制bean
ProjectListReq req = new ProjectListReq();
BeanUtils.copyProperties(preReq,req);
//项目阶段 状态 已定 待预审
req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
req.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
return projectLibManage.projectLibList(req);
return prequalificationDeclaredProjectManage.projectLibList(preReq);
}

@ApiOperation(value = "申报预审", notes = "申报预审")


+ 1
- 11
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ProjectAdjustmentController.java Näytä tiedosto

@@ -39,17 +39,7 @@ public class ProjectAdjustmentController {
@ApiOperation(value = "可做项目内容调整的列表", notes = "可做项目内容调整的列表")
@GetMapping("/list")
public PageVo<ProjectLibListItemVO> list(@Validated @ModelAttribute AdjustmentListReq preReq) {
//限定参数 复制bean
ProjectListReq req = new ProjectListReq();
BeanUtils.copyProperties(preReq,req);
//项目阶段 状态 已定 方案待申报
req.setStageList(Arrays.asList(ProjectStatusEnum.NOT_APPROVED.getCode()));
//只有 单位内部审核不通过 省级联审不通过 预审不通过 建设方案不通过 4种状态
req.setStatusList(Arrays.asList(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(),
ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(),
ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode(),
ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()));
return projectLibManage.projectLibList(req);
return projectAdjustmentManage.projectLibList(preReq);
}

@ApiOperation(value = "项目内容调整", notes = "项目内容调整")


+ 32
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java Näytä tiedosto

@@ -4,16 +4,24 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils;
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectConditionDTO;
import com.ningdatech.pmapi.projectdeclared.model.req.ConstrctionPlanListReq;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import com.ningdatech.pmapi.projectlib.service.IProjectInstService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import com.wflow.bean.entity.WflowModels;
import com.wflow.exception.BusinessException;
import com.wflow.workflow.bean.vo.ProcessStartParamsVo;
@@ -52,6 +60,10 @@ public class ConstructionPlanManage {

private final IProjectInstService projectInstService;

private final ProjectLibManage projectLibManage;

private final UserInfoHelper userInfoHelper;

/**
* 建设方案
*
@@ -131,4 +143,24 @@ public class ConstructionPlanManage {
throw new BusinessException("提交建设方案 项目信息修改 错误 :" + e.getMessage());
}
}

/**
* 查项目
* @param planReq
* @return
*/
public PageVo<ProjectLibListItemVO> projectLibList(ConstrctionPlanListReq planReq) {
//限定参数 复制bean
ProjectListReq req = new ProjectListReq();
BeanUtils.copyProperties(planReq,req);
//项目阶段 状态 已定 方案待申报
req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
req.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode());
Long userId = LoginUserUtil.getUserId();
VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!");
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId);
//放入用户的单位
req.setBuildOrgCode(userFullInfo.getOrganizationCode());
return projectLibManage.projectLibList(req);
}
}

+ 75
- 60
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java Näytä tiedosto

@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.projectdeclared.model.entity.ProjectDraft;
import com.ningdatech.pmapi.projectdeclared.model.dto.DeclaredProjectListParamDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO;
@@ -17,13 +18,18 @@ import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectDraftSaveDTO;
import com.ningdatech.pmapi.projectdeclared.model.vo.ProjectDraftVO;
import com.ningdatech.pmapi.projectdeclared.service.IProjectDraftService;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService;
import com.ningdatech.pmapi.projectlib.service.IProjectInstService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import com.wflow.bean.entity.WflowModels;
import com.wflow.exception.BusinessException;
import com.wflow.workflow.bean.vo.ProcessStartParamsVo;
@@ -68,42 +74,9 @@ public class DeclaredProjectManage {

private final DefaultDeclaredProjectManage defaultDeclaredProjectManage;

public PageVo<ProjectDraftVO> pageDraft(DeclaredProjectListParamDTO params) {
Page<ProjectDraft> page = params.page();
LambdaQueryWrapper<ProjectDraft> wrapper = Wrappers.lambdaQuery(ProjectDraft.class)
.eq(ProjectDraft::getUserId,params.getUserId())
.ge(Objects.nonNull(params.getStartTime()), ProjectDraft::getCreateOn, params.getStartTime())
.le(Objects.nonNull(params.getEndTime()), ProjectDraft::getCreateOn, params.getEndTime())
.eq(Objects.nonNull(params.getProjectType()), ProjectDraft::getProjectType, params.getProjectType())
.eq(Objects.nonNull(params.getProjectYear()), ProjectDraft::getProjectYear, params.getProjectYear())
.eq(Objects.nonNull(params.getProjectStage()), ProjectDraft::getStage, params.getProjectStage())
.eq(Objects.nonNull(params.getProjectStatus()), ProjectDraft::getStatus, params.getProjectStatus())
.like(StringUtils.isNotBlank(params.getProjectName()), ProjectDraft::getProjectName, params.getProjectName())
.orderByDesc(ProjectDraft::getUpdateOn);
projectDraftService.page(page, wrapper);
if (0L == page.getTotal()) {
return PageVo.empty();
}
List<ProjectDraftVO> res = page.getRecords().stream().map(record -> {
ProjectDraftVO vo = new ProjectDraftVO();
BeanUtils.copyProperties(record, vo);
return vo;
}).collect(Collectors.toList());
return PageVo.of(res, page.getTotal());
}

public ProjectDraftVO draftDatail(Long id) {
ProjectDraft draft = projectDraftService.getById(id);
ProjectDraftVO vo = new ProjectDraftVO();
BeanUtils.copyProperties(draft, vo);
if(StringUtils.isNotBlank(draft.getProjectApplicationList())){
vo.setApplicationList(JSON.parseArray(draft.getProjectApplicationList(),ProjectApplication.class));
}
if(StringUtils.isNotBlank(draft.getDynamicForm())){
vo.setDynamicForm(JSON.parseObject(draft.getDynamicForm(),Map.class));
}
return vo;
}
private final ProjectLibManage projectlibManager;
private final UserInfoHelper userInfoHelper;

/**
* 新项目 启动实例
@@ -113,6 +86,10 @@ public class DeclaredProjectManage {
*/
@Transactional(rollbackFor = Exception.class)
public String startTheProcess(DefaultDeclaredDTO dto) {
Long userId = LoginUserUtil.getUserId();
VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!");
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId);

ProjectDTO projectInfo = dto.getProjectInfo();

//如果是重新提交的话 判断下 项目是否存在
@@ -153,7 +130,7 @@ public class DeclaredProjectManage {
log.info("申报项目成功 【{}】", instanceId);

//如果是重新提交的话 判断下 项目是否存在
saveOrUpdateProject(dto.getProjectInfo(), instanceId, regionCode);
saveOrUpdateProject(dto.getProjectInfo(), instanceId, regionCode,userId);

return instanceId;
}
@@ -166,6 +143,8 @@ public class DeclaredProjectManage {
*/
@Transactional(rollbackFor = Exception.class)
public String reStartTheProcess(DefaultDeclaredDTO dto) {
Long userId = LoginUserUtil.getUserId();

ProjectDTO projectDto = dto.getProjectInfo();
VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!");
Project projectInfo = projectService.getById(projectDto.getId());
@@ -202,39 +181,19 @@ public class DeclaredProjectManage {
log.info("重新申报项目成功 【{}】", instanceId);

//保存项目
modifyProject(projectInfo, instanceId);
saveOrUpdateProject(projectDto,instanceId,regionCode,userId);

return instanceId;
}

private void modifyProject(Project project, String instanceId) {
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示
try {
project.setUpdateOn(LocalDateTime.now());
project.setInstCode(instanceId);
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
projectService.updateById(project);
//保存项目和实例的关系
ProjectInst projectInst = new ProjectInst();
projectInst.setProjectId(project.getId());
projectInst.setInstCode(instanceId);
projectInst.setCreatOn(LocalDateTime.now());
projectInst.setUpdateOn(LocalDateTime.now());
projectInstService.save(projectInst);
} catch (Exception e) {
log.error("重新申报项目 项目信息修改 错误 ", e);
throw new BusinessException("重新申报项目 项目信息修改 错误 :" + e.getMessage());
}
}

/**
* 申报项目 时 新增项目到项目库
*
* @param projectDto
* @param instanceId
*/
private void saveOrUpdateProject(ProjectDTO projectDto, String instanceId, String regionCode) {
private void saveOrUpdateProject(ProjectDTO projectDto, String instanceId,
String regionCode,Long userId) {
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示
try {
//保存项目表信息
@@ -246,9 +205,13 @@ public class DeclaredProjectManage {
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
project.setInstCode(instanceId);
project.setSponsor(userId);
projectService.saveOrUpdate(project);
//保存项目应用
if (CollUtil.isNotEmpty(projectDto.getApplicationList())) {
//采取批量删除 批量添加的方式
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectId,project.getId()));
List<ProjectApplication> applications = projectDto.getApplicationList().stream().map(application -> {
ProjectApplication projectApplication = new ProjectApplication();
BeanUtils.copyProperties(application, projectApplication);
@@ -271,6 +234,44 @@ public class DeclaredProjectManage {
}
}

public PageVo<ProjectDraftVO> pageDraft(DeclaredProjectListParamDTO params) {
Long userId = LoginUserUtil.getUserId();
Page<ProjectDraft> page = params.page();
LambdaQueryWrapper<ProjectDraft> wrapper = Wrappers.lambdaQuery(ProjectDraft.class)
.eq(ProjectDraft::getUserId,userId)
.ge(Objects.nonNull(params.getStartTime()), ProjectDraft::getCreateOn, params.getStartTime())
.le(Objects.nonNull(params.getEndTime()), ProjectDraft::getCreateOn, params.getEndTime())
.eq(Objects.nonNull(params.getProjectType()), ProjectDraft::getProjectType, params.getProjectType())
.eq(Objects.nonNull(params.getProjectYear()), ProjectDraft::getProjectYear, params.getProjectYear())
.eq(Objects.nonNull(params.getProjectStage()), ProjectDraft::getStage, params.getProjectStage())
.eq(Objects.nonNull(params.getProjectStatus()), ProjectDraft::getStatus, params.getProjectStatus())
.like(StringUtils.isNotBlank(params.getProjectName()), ProjectDraft::getProjectName, params.getProjectName())
.orderByDesc(ProjectDraft::getUpdateOn);
projectDraftService.page(page, wrapper);
if (0L == page.getTotal()) {
return PageVo.empty();
}
List<ProjectDraftVO> res = page.getRecords().stream().map(record -> {
ProjectDraftVO vo = new ProjectDraftVO();
BeanUtils.copyProperties(record, vo);
return vo;
}).collect(Collectors.toList());
return PageVo.of(res, page.getTotal());
}

public ProjectDraftVO draftDatail(Long id) {
ProjectDraft draft = projectDraftService.getById(id);
ProjectDraftVO vo = new ProjectDraftVO();
BeanUtils.copyProperties(draft, vo);
if(StringUtils.isNotBlank(draft.getProjectApplicationList())){
vo.setApplicationList(JSON.parseArray(draft.getProjectApplicationList(),ProjectApplication.class));
}
if(StringUtils.isNotBlank(draft.getDynamicForm())){
vo.setDynamicForm(JSON.parseObject(draft.getDynamicForm(),Map.class));
}
return vo;
}

/**
* 保存至草稿箱
*
@@ -295,4 +296,18 @@ public class DeclaredProjectManage {
projectDraftService.saveOrUpdate(draft);
return draft.getId();
}

/**
* 项目列表
* @param req
* @return
*/
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) {
Long userId = LoginUserUtil.getUserId();
VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!");
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId);
//放入用户的单位
req.setBuildOrgCode(userFullInfo.getOrganizationCode());
return projectlibManager.projectLibList(req);
}
}

+ 32
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java Näytä tiedosto

@@ -4,18 +4,26 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils;
import com.ningdatech.pmapi.projectdeclared.contants.DeclaredProjectContant;
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectConditionDTO;
import com.ningdatech.pmapi.projectdeclared.model.req.PrequalificationDeclaredListReq;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import com.ningdatech.pmapi.projectlib.service.IProjectInstService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.staging.serivice.IProjectStagingService;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import com.wflow.bean.entity.WflowModels;
import com.wflow.exception.BusinessException;
import com.wflow.workflow.bean.vo.ProcessStartParamsVo;
@@ -55,6 +63,10 @@ public class PrequalificationDeclaredProjectManage {

private final IProjectStagingService projectStagingService;

private final ProjectLibManage projectLibManage;

private final UserInfoHelper userInfoHelper;

/**
* 提交预审
*
@@ -160,4 +172,24 @@ public class PrequalificationDeclaredProjectManage {
throw new BusinessException("提交预审 项目信息修改 错误 :" + e.getMessage());
}
}

/**
* 查询项目库
* @param preReq
* @return
*/
public PageVo<ProjectLibListItemVO> projectLibList(PrequalificationDeclaredListReq preReq) {
//限定参数 复制bean
ProjectListReq req = new ProjectListReq();
BeanUtils.copyProperties(preReq,req);
//项目阶段 状态 已定 待预审
req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
req.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
Long userId = LoginUserUtil.getUserId();
VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!");
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId);
//放入用户的单位
req.setBuildOrgCode(userFullInfo.getOrganizationCode());
return projectLibManage.projectLibList(req);
}
}

+ 38
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ProjectAdjustmentManage.java Näytä tiedosto

@@ -3,13 +3,22 @@ package com.ningdatech.pmapi.projectdeclared.manage;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO;
import com.ningdatech.pmapi.projectdeclared.model.req.AdjustmentListReq;
import com.ningdatech.pmapi.projectdeclared.utils.ReStartProcessMapUtil;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import com.wflow.exception.BusinessException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -18,6 +27,7 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.function.Function;
@@ -42,6 +52,10 @@ public class ProjectAdjustmentManage {

private final DefaultDeclaredProjectManage defaultDeclaredProjectManage;

private final ProjectLibManage projectLibManage;

private final UserInfoHelper userInfoHelper;

/**
* 项目内容调整
* @param dto
@@ -93,4 +107,28 @@ public class ProjectAdjustmentManage {
}
return Boolean.TRUE;
}

/**
* 项目库
* @param preReq
* @return
*/
public PageVo<ProjectLibListItemVO> projectLibList(AdjustmentListReq preReq) {
//限定参数 复制bean
ProjectListReq req = new ProjectListReq();
BeanUtils.copyProperties(preReq,req);
//项目阶段 状态 已定 方案待申报
req.setStageList(Arrays.asList(ProjectStatusEnum.NOT_APPROVED.getCode()));
//只有 单位内部审核不通过 省级联审不通过 预审不通过 建设方案不通过 4种状态
req.setStatusList(Arrays.asList(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(),
ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(),
ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode(),
ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()));
Long userId = LoginUserUtil.getUserId();
VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!");
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId);
//放入用户的单位
req.setBuildOrgCode(userFullInfo.getOrganizationCode());
return projectLibManage.projectLibList(req);
}
}

+ 97
- 41
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java Näytä tiedosto

@@ -1,20 +1,34 @@
package com.ningdatech.pmapi.projectdeclared.manage;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Maps;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectConditionDTO;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst;
import com.ningdatech.pmapi.projectlib.service.IProjectInstService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import com.wflow.bean.entity.WflowModels;
import com.wflow.exception.BusinessException;
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto;
import com.wflow.workflow.bean.vo.ProcessStartParamsVo;
import com.wflow.workflow.service.ProcessInstanceService;
import com.wflow.workflow.service.ProcessModelService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.Collections;
import java.util.Map;
import java.util.Objects;

/**
@@ -36,52 +50,94 @@ public class ReviewByDeptJointManage {

private final IProjectInstService projectInstService;

private final UserInfoHelper userInfoHelper;

/**
* 省级部门联审
* 部门联审
* @param project
* @return
*/
@Transactional(rollbackFor = Exception.class)
public Boolean startTheProcess(Project project) {
VUtils.isTrue(Objects.isNull(project.getId())).throwMessage("提交失败 缺少项目ID!");
Project projectInfo = projectService.getById(project.getId());
VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!");
String regionCode = projectInfo.getAreaCode();

WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
.eq(WflowModels::getRegionCode, regionCode)
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode())
.last("limit 1"));

if (Objects.isNull(model)) {
log.error("此 【{}】区域找不到 部门联审申报流程配置", regionCode);
throw new BusinessException(String.format("此 【%s】区域找不到 部门联审申报流程配置", regionCode));
}
//要判断 项目当前状态 是不是 部门联审
VUtils.isTrue(!ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode().equals(projectInfo.getStatus()) ||
!ProjectStatusEnum.NOT_APPROVED.getCode().equals(projectInfo.getStage()))
.throwMessage("提交失败 该项目不是 省级部门联审状态状态或者未立项阶段");

// 再判断 该项目是否 真实走完 预审审批 并且提取出 提交人
// projectInstService.
//
// ProcessStartParamsVo params = new ProcessStartParamsVo();
// params.setUser(dto.getUser());
// params.setProcessUsers(Collections.emptyMap());
// //放入条件判断的项目字段
// ProjectConditionDTO conditionDto = new ProjectConditionDTO();
// BeanUtils.copyProperties(projectInfo, conditionDto);
// dto.getFormData().putAll(
// JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference<Map<String, Object>>() {
// })
// );
// params.setFormData(dto.getFormData());
// String instanceId = processService.startProcess(model.getProcessDefId(), params);
// log.info("建设方案项目申报成功 【{}】", instanceId);
//
// //保存建设项目
// modifyProject(projectInfo, instanceId, projectInfo.getConstructionPlanFile());

return null;
VUtils.isTrue(Objects.isNull(project.getId())).throwMessage("提交失败 缺少项目ID!");
Project projectInfo = projectService.getById(project.getId());
VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!");
String regionCode = projectInfo.getAreaCode();

WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
.eq(WflowModels::getRegionCode, regionCode)
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode())
.last("limit 1"));

if (Objects.isNull(model)) {
log.error("此 【{}】区域找不到 部门联审申报流程配置", regionCode);
throw new BusinessException(String.format("此 【%s】区域找不到 部门联审申报流程配置", regionCode));
}
//要判断 项目当前状态 是不是 部门联审
VUtils.isTrue(!ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode().equals(projectInfo.getStatus()) ||
!ProjectStatusEnum.NOT_APPROVED.getCode().equals(projectInfo.getStage()))
.throwMessage("提交失败 该项目不是 省级部门联审状态状态或者未立项阶段");

// 再判断 该项目是否 真实走完 预审审批 并且提取出 提交人
VUtils.isTrue(Objects.isNull(projectInfo.getSponsor()))
.throwMessage("提交失败 项目信息 缺少项目发起人!");
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(projectInfo.getSponsor());
VUtils.isTrue(Objects.isNull(userFullInfo))
.throwMessage("提交失败 项目发起人不存在!");

ProcessStartParamsVo params = new ProcessStartParamsVo();
params.setUser(buildUser(userFullInfo));
params.setProcessUsers(Collections.emptyMap());

Map<String, Object> formData = Maps.newHashMap();
//放入条件判断的项目字段
ProjectConditionDTO conditionDto = new ProjectConditionDTO();
BeanUtils.copyProperties(projectInfo, conditionDto);
formData.putAll(
JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference<Map<String, Object>>() {
})
);
params.setFormData(formData);
String instanceId = processService.startProcess(model.getProcessDefId(), params);
log.info("部门联审申报成功 【{}】", instanceId);

//保存项目信息
if(!modifyProject(projectInfo, instanceId)){
return Boolean.FALSE;
}

return Boolean.TRUE;
}

private ProcessInstanceUserDto buildUser(UserFullInfoDTO userFullInfo) {
return ProcessInstanceUserDto.builder()
.userId(String.valueOf(userFullInfo.getUserId()))
.userName(userFullInfo.getRealName())
.orgCode(userFullInfo.getOrganizationCode())
.orgName(userFullInfo.getOrganizationName())
.build();
}

private Boolean modifyProject(Project project, String instanceId) {
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示
try {
project.setUpdateOn(LocalDateTime.now());
project.setInstCode(instanceId);
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
projectService.updateById(project);
//保存项目和实例的关系
ProjectInst projectInst = new ProjectInst();
projectInst.setProjectId(project.getId());
projectInst.setInstCode(instanceId);
projectInst.setCreatOn(LocalDateTime.now());
projectInst.setUpdateOn(LocalDateTime.now());
projectInst.setInstType(ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode());
projectInstService.save(projectInst);
} catch (Exception e) {
log.error("部门联审 修改项目信息 错误 ", e);
throw new BusinessException("部门联审 修改项目信息 错误 :" + e.getMessage());
}
return Boolean.TRUE;
}
}

+ 0
- 4
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/DeclaredProjectListParamDTO.java Näytä tiedosto

@@ -19,10 +19,6 @@ import org.springframework.format.annotation.DateTimeFormat;
@NoArgsConstructor
@AllArgsConstructor
public class DeclaredProjectListParamDTO extends PagePo {

@ApiModelProperty("用户ID")
private String userId;

@ApiModelProperty("项目名称")
private String projectName;



+ 0
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/DefaultDeclaredDTO.java Näytä tiedosto

@@ -31,7 +31,6 @@ public class DefaultDeclaredDTO implements Serializable {
@ApiModelProperty("表单信息 保留")
private Map<String,Object> formData;

@NotNull
@ApiModelProperty("用户信息 暂时填一下")
private ProcessInstanceUserDto user;



+ 1
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java Näytä tiedosto

@@ -44,6 +44,7 @@ public class ProjectHelper {
.le(req.getApproveAmountMax() != null, Project::getApprovalAmount, req.getApproveAmountMax())

.like(req.getBuildOrg() != null, Project::getBuildOrgName, req.getBuildOrg())
.eq(req.getBuildOrgCode() != null, Project::getBuildOrgCode, req.getBuildOrgCode())
.eq(req.getIsTemporaryAugment() != null, Project::getIsTemporaryAugment, req.getIsTemporaryAugment())
//状态 阶段 list
.in(CollUtil.isNotEmpty(req.getStageList()),Project::getStage,req.getStageList())


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java Näytä tiedosto

@@ -271,6 +271,6 @@ public class ProjectDTO implements Serializable {
private Map<String,Object> dynamicForm;

@ApiModelProperty("项目发起人")
private String sponsor;
private Long sponsor;

}

+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java Näytä tiedosto

@@ -285,8 +285,8 @@ public class Project implements Serializable {
@ApiModelProperty("动态表单 json")
private String dynamicForm;

@ApiModelProperty("项目发起人")
private String sponsor;
@ApiModelProperty("项目发起人 用户id")
private Long sponsor;

@TableField(fill = FieldFill.INSERT)
private Long createBy;


+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectListReq.java Näytä tiedosto

@@ -34,6 +34,8 @@ public class ProjectListReq extends PagePo {

@ApiModelProperty("申报单位")
private String buildOrg;
@ApiModelProperty("申报单位code")
private String buildOrgCode;

@ApiModelProperty("项目类型")
private Integer projectType;


+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java Näytä tiedosto

@@ -277,8 +277,8 @@ public class ProjectDetailVO {
@ApiModelProperty("年度投资金额详情")
private List<AnnualAmountVO> annualAccumulateAmountList;

@ApiModelProperty("项目发起人")
private String sponsor;
@ApiModelProperty("项目发起人id")
private Long sponsor;

private String projectTypeName;



Loading…
Peruuta
Tallenna