Kaynağa Gözat

Merge remote-tracking branch 'origin/master'

tags/24080901
CMM 1 yıl önce
ebeveyn
işleme
5938c4e647
14 değiştirilmiş dosya ile 176 ekleme ve 82 silme
  1. +22
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/CommonEnum.java
  2. +7
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java
  3. +88
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java
  4. +11
    -69
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java
  5. +17
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java
  6. +1
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java
  7. +3
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java
  8. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java
  9. +6
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java
  10. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectListReq.java
  11. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java
  12. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/NdWorkNoticeStagingMapper.xml
  13. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/ProjectStagingMapper.xml
  14. +10
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserDetailVO.java

+ 22
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/CommonEnum.java Dosyayı Görüntüle

@@ -0,0 +1,22 @@
package com.ningdatech.pmapi.common.enumeration;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
* @author zpf
* @date 2023/3/12 上午9:21
*/
@AllArgsConstructor
@Getter
public enum CommonEnum {
/**
* 公共的一些枚举
*/
YES(1,"是"),
NO(0,"否");

private Integer code;
private String desc;

}

+ 7
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java Dosyayı Görüntüle

@@ -12,6 +12,7 @@ import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.NdDateUtils;
import com.ningdatech.pmapi.common.constant.CommonConst;
import com.ningdatech.pmapi.common.constant.RegionConst;
import com.ningdatech.pmapi.common.enumeration.CommonEnum;
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum;
import com.ningdatech.pmapi.common.helper.RegionCacheHelper;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
@@ -115,6 +116,12 @@ public class DeclaredProjectManage {
projectInfo.setBuildOrgCode(userInfoDetails.getOrganizationCode());
projectInfo.setBuildOrgName(userInfoDetails.getOrganizationName());

//如果主管单位没有 那么主管单位就是自己
if(CommonEnum.NO.getCode().equals(projectInfo.getIsSuperOrg())){
projectInfo.setSuperOrgCode(userInfoDetails.getOrganizationCode());
projectInfo.setSuperOrg(userInfoDetails.getOrganizationName());
}

//如果是重新提交的话 判断下 项目是否存在
if(Objects.nonNull(projectInfo.getId())){
Project oldProject = projectService.getById(projectInfo.getId());


+ 88
- 4
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java Dosyayı Görüntüle

@@ -1,29 +1,41 @@
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.ningdatech.basic.function.VUtils;
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.organization.model.entity.DingOrganization;
import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectConditionDTO;
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.service.IProjectInstService;
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 com.wflow.bean.entity.WflowModels;
import com.wflow.bean.entity.WflowOrgModels;
import com.wflow.enums.OrgTypeEnum;
import com.wflow.enums.ProcessDefTypeEnum;
import com.wflow.exception.BusinessException;
import com.wflow.service.OrgProcdefService;
import com.wflow.workflow.bean.dto.OrgInfoDTO;
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 java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;

/**
@@ -45,6 +57,14 @@ public class DefaultDeclaredProjectManage {
private final IDingOrganizationService dingOrganizationService;
private final OrgProcdefService orgProcdefService;

private final ProcessModelService processModelService;

private final ProcessInstanceService processService;

private final IProjectInstService projectInstService;

private final StateMachineUtils stateMachineUtils;

//项目名称去重
public void checkDuplication(ProjectDTO project){
VUtils.isTrue(projectService.count(Wrappers.lambdaQuery(Project.class)
@@ -120,4 +140,68 @@ public class DefaultDeclaredProjectManage {
orgMap.put(OrgTypeEnum.TARGET_LABEL.name(),orgInfoDTO);
return orgMap;
}

//直接提交预审方法 提取 在省级联审通过的时候 也可以用
public String directStartProcess(Project projectInfo,Long userId){
VUtils.isTrue(Objects.isNull(userId))
.throwMessage("发起人Id 不能为空!");

ProcessStartParamsVo params = new ProcessStartParamsVo();
params.setUser(buildUser(userId));
params.setProcessUsers(Collections.emptyMap());
//放入条件判断的项目字段
ProjectConditionDTO conditionDto = new ProjectConditionDTO();
BeanUtils.copyProperties(projectInfo, conditionDto);
params.setFormData(JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference<Map<String, Object>>() {
}));

String regionCode = projectInfo.getAreaCode();

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

if (Objects.isNull(model)) {
log.error("此 【{}】区域找不到 预审流程配置", regionCode);
throw new BusinessException(String.format("此 【%s】区域找不到 预审流程配置", regionCode));
}

// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息
Map<String, OrgInfoDTO> orgModelMap = getOrgModelInfo(userId,projectInfo);
String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap);
log.info("提交预审项目成功 【{}】", instanceId);

//保存预审项目
preModifyProject(projectInfo, instanceId);

return instanceId;
}

/**
* 提交预审项目 时 更新信息
*
* @param project
* @param instanceId
*/
private void preModifyProject(Project project, String instanceId) {
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示
try {
project.setUpdateOn(LocalDateTime.now());
project.setInstCode(instanceId);
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.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode());
projectInstService.save(projectInst);
} catch (Exception e) {
log.error("提交预审 项目信息修改 错误 ", e);
throw new BusinessException("提交预审 项目信息修改 错误 :" + e.getMessage());
}
}
}

+ 11
- 69
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java Dosyayı Görüntüle

@@ -33,6 +33,7 @@ import com.ningdatech.pmapi.projectlib.service.IProjectInstService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.staging.service.IProjectStagingService;
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 com.wflow.bean.entity.WflowModels;
import com.wflow.exception.BusinessException;
@@ -70,12 +71,6 @@ public class PrequalificationDeclaredProjectManage {

private final StateMachineUtils stateMachineUtils;

private final ProcessInstanceService processService;

private final ProcessModelService processModelService;

private final IProjectInstService projectInstService;

private final IProjectStagingService projectStagingService;

private final ProjectLibManage projectLibManage;
@@ -94,7 +89,8 @@ public class PrequalificationDeclaredProjectManage {
*/
@Transactional(rollbackFor = Exception.class)
public String startTheProcess(DefaultDeclaredDTO dto) {
Long userId = LoginUserUtil.getUserId();
UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail();
Long userId = userInfoDetails.getUserId();
VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!");

ProjectDTO projectDto = dto.getProjectInfo();
@@ -102,17 +98,9 @@ public class PrequalificationDeclaredProjectManage {
Project projectInfo = projectService.getById(projectDto.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.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode())
.last("limit 1"));

if (Objects.isNull(model)) {
log.error("此 【{}】区域找不到 预审流程配置", regionCode);
throw new BusinessException(String.format("此 【%s】区域找不到 预审流程配置", regionCode));
}
//要判断 当前操作人 是不是项目主管单位的人
VUtils.isTrue(!userInfoDetails.getOrganizationCode().equals(projectInfo.getSuperOrgCode()))
.throwMessage(String.format("只有主管单位 【%s】的人 才能够提交",projectInfo.getSuperOrg()));

//首先要判断 项目当前状态 是不是 待预审
VUtils.isTrue(!ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(projectInfo.getStatus()) ||
@@ -128,6 +116,8 @@ public class PrequalificationDeclaredProjectManage {
.getCode().equals(projectInfo.getStatus())){
//入库暂存表 后续处理 对接外部接口
projectInfo.setUpdateOn(LocalDateTime.now());
//保存一下 当前的主管单位发起人
projectInfo.setPreStartUserId(userId);
if(projectStagingService.addByProject(projectInfo,"省级部门联审")
&& projectService.updateById(projectInfo)){
return "提交省级部门联审成功";
@@ -136,26 +126,7 @@ public class PrequalificationDeclaredProjectManage {
}else if(ProjectStatusEnum.PRE_APPLYING
.getCode().equals(projectInfo.getStatus())){
//如果是非省级联审的项目 直接提交 预审
ProcessStartParamsVo params = new ProcessStartParamsVo();
params.setUser(declaredProjectManage.buildUser(userId));
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());

// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId,projectInfo);
instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap);
log.info("提交预审项目成功 【{}】", instanceId);

//保存预审项目
modifyProject(projectInfo, instanceId);

instanceId = defaultDeclaredProjectManage.directStartProcess(projectInfo,userId);
}else{
throw new BusinessException("项目状态 错误 project :" + JSON.toJSONString(projectInfo));
}
@@ -164,35 +135,6 @@ public class PrequalificationDeclaredProjectManage {
}

/**
* 提交预审项目 时 更新信息
*
* @param project
* @param instanceId
*/
private void modifyProject(Project project, String instanceId) {
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示
try {
project.setUpdateOn(LocalDateTime.now());
project.setInstCode(instanceId);
//调用状态机 进入下一个通过状态
stateMachineUtils.pass(project);
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.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode());
projectInstService.save(projectInst);
} catch (Exception e) {
log.error("提交预审 项目信息修改 错误 ", e);
throw new BusinessException("提交预审 项目信息修改 错误 :" + e.getMessage());
}
}

/**
* 查询项目库
* @param preReq
* @return
@@ -207,8 +149,8 @@ public class PrequalificationDeclaredProjectManage {
Long userId = LoginUserUtil.getUserId();
VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!");
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId);
//放入用户的单位
req.setBuildOrgCode(userFullInfo.getOrganizationCode());
//放入用户的主管单位
req.setSuperOrgCode(userFullInfo.getOrganizationCode());
return projectLibManage.projectLibList(req);
}



+ 17
- 3
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java Dosyayı Görüntüle

@@ -1,11 +1,15 @@
package com.ningdatech.pmapi.projectdeclared.manage;

import com.ningdatech.basic.function.VUtils;
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils;
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.Objects;
@@ -23,6 +27,10 @@ public class ReviewByProvincialDeptManage {

private final IProjectService projectService;

private final StateMachineUtils stateMachineUtils;

private final DefaultDeclaredProjectManage defaultProjectManage;

/**
* 省级部门联审
* @param project
@@ -40,10 +48,16 @@ public class ReviewByProvincialDeptManage {
!ProjectStatusEnum.NOT_APPROVED.getCode().equals(projectInfo.getStage()))
.throwMessage("提交失败 该项目不是 省级部门联审状态状态或者未立项阶段");
// TODO 对接省级联审的接口
Boolean sucessProvince = Boolean.FALSE;
Boolean sucessProvince = Boolean.TRUE;
if(sucessProvince){
//成功了后

//测试先成功
stateMachineUtils.pass(project);
projectService.updateById(project);
//直接去预审
if(StringUtils.isNotBlank(defaultProjectManage
.directStartProcess(project,project.getPreStartUserId()))){
return Boolean.TRUE;
}
}

return Boolean.FALSE;


+ 1
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java Dosyayı Görüntüle

@@ -45,6 +45,7 @@ public class ProjectHelper {

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


+ 3
- 4
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java Dosyayı Görüntüle

@@ -222,15 +222,14 @@ public class AnnualPlanLibManage {
public void exportList(ProjectListReq param, HttpServletResponse response) {
param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER);
param.setPageSize(CommonConst.EXPORT_PAGE_SIZE);
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param);
Integer isTemporaryAugment = param.getIsTemporaryAugment();
if (Objects.isNull(isTemporaryAugment)) {
throw new BizException("请传入是否临时增补标志!");
}
query.eq(Project::getIsTemporaryAugment, isTemporaryAugment);
query.eq(Project::getIsTemporaryAugment, 0);
param.setIsTemporaryAugment(isTemporaryAugment);
param.setStatusList(CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode));
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param);
query.orderByDesc(Project::getAnnualPlanAddTime);
query.in(Project::getStatus, CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode));
List<Project> projects = projectService.list(query);

ExcelExportWriter excelExportWriter = new ExcelExportWriter();


+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java Dosyayı Görüntüle

@@ -282,6 +282,9 @@ public class ProjectDTO implements Serializable {
@ApiModelProperty("项目发起人")
private Long sponsor;

@ApiModelProperty("上级条线单位审核意见")
private String higherLineSuperOrgReviewComments;

private Map<String,Object> dynamicForm;

}

+ 6
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java Dosyayı Görüntüle

@@ -297,6 +297,12 @@ public class Project implements Serializable {
@ApiModelProperty("项目发起人 用户id")
private Long sponsor;

@ApiModelProperty("预审发起人 用户id")
private Long preStartUserId;

@ApiModelProperty("上级条线单位审核意见")
private String higherLineSuperOrgReviewComments;

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



+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectListReq.java Dosyayı Görüntüle

@@ -39,6 +39,9 @@ public class ProjectListReq extends PagePo {
@ApiModelProperty("申报单位code")
private String buildOrgCode;

@ApiModelProperty("主管单位code")
private String superOrgCode;

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



+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java Dosyayı Görüntüle

@@ -289,6 +289,9 @@ public class ProjectDetailVO {
@ApiModelProperty("项目发起人id")
private Long sponsor;

@ApiModelProperty("上级条线单位审核意见")
private String higherLineSuperOrgReviewComments;

private String projectTypeName;

public String getProjectTypeName() {


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/NdWorkNoticeStagingMapper.xml Dosyayı Görüntüle

@@ -7,6 +7,6 @@
set retry_times = #{retryTimes},
next_time = #{nextRetryTime},
dead = #{dead}
where id = #{id} and retry_times = #{retryTimes - 1}
where id = #{id} and retry_times = #{retryTimes} - 1
</update>
</mapper>

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/ProjectStagingMapper.xml Dosyayı Görüntüle

@@ -7,6 +7,6 @@
set retry_times = #{retryTimes},
next_time = #{nextRetryTime},
dead = #{dead}
where id = #{id} and retry_times = #{retryTimes - 1}
where id = #{id} and retry_times = #{retryTimes} - 1
</update>
</mapper>

+ 10
- 0
pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserDetailVO.java Dosyayı Görüntüle

@@ -1,5 +1,6 @@
package com.ningdatech.pmapi.user.model.vo;

import com.ningdatech.pmapi.common.constant.RegionConst;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -48,4 +49,13 @@ public class ResUserDetailVO {

@ApiModelProperty("更新时间")
private LocalDateTime updateTime;

//是否是市级单位
public Boolean getIsMunicipalOrg(){
//如果是丽水市本级的code 就是
if(RegionConst.RC_LS.equals(this.regionCode)){
return Boolean.TRUE;
}
return Boolean.FALSE;
}
}

Yükleniyor…
İptal
Kaydet