Browse Source

盖章并通过修改

tags/24080901
CMM 1 year ago
parent
commit
8510005e57
4 changed files with 216 additions and 43 deletions
  1. +44
    -32
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java
  2. +122
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java
  3. +46
    -11
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java
  4. +4
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/SealInfoDTO.java

+ 44
- 32
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java View File

@@ -9,7 +9,10 @@ import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.NdDateUtils;
import com.ningdatech.pmapi.common.constant.BizConst;
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;
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils;
import com.ningdatech.pmapi.common.util.ExcelDownUtil;
@@ -68,23 +71,16 @@ import java.util.stream.Collectors;
public class ConstructionPlanManage {

private final IProjectService projectService;

private final ProcessInstanceService processService;

private final ProcessModelService processModelService;

private final StateMachineUtils stateMachineUtils;

private final IProjectInstService projectInstService;

private final ProjectLibManage projectLibManage;

private final UserInfoHelper userInfoHelper;

private final DefaultDeclaredProjectManage declaredProjectManage;
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage;

private final NoticeManage noticeManage;
private final RegionCacheHelper regionCacheHelper;

/**
* 建设方案
@@ -99,16 +95,37 @@ public class ConstructionPlanManage {
VUtils.isTrue(Objects.isNull(user) || Objects.isNull(employeeCode))
.throwMessage("获取登录用户失败!");

ProjectDTO projectDto = dto.getProjectInfo();
VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!");
Project projectInfo = projectService.getNewProject(projectDto.getId());
VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!");
VUtils.isTrue(StringUtils.isBlank(projectDto.getConstructionPlanFile())).throwMessage("提交失败 请提交建设方案!");
ProjectDTO projectInfo = dto.getProjectInfo();

if(StringUtils.isNotBlank(user.getRegionCode())){
projectInfo.setAreaCode(user.getRegionCode());
projectInfo.setArea(regionCacheHelper.getRegionName(user.getRegionCode(), RegionConst.RL_COUNTY));
}

projectInfo.setBuildOrgCode(user.getEmpPosUnitCode());
projectInfo.setBuildOrgName(user.getEmpPosUnitName());

// 项目名称去重
defaultDeclaredProjectManage.checkDuplication(projectInfo);
//判断申报金额 是否等于总的 判断年度支付金额 是否等于总金额
defaultDeclaredProjectManage.checkAmount(projectInfo);

String regionCode = projectInfo.getAreaCode();
//如果主管单位没有 那么主管单位就是自己
if(CommonEnum.NO.getCode().equals(projectInfo.getIsSuperOrg())){
projectInfo.setSuperOrgCode(user.getEmpPosUnitCode());
projectInfo.setSuperOrg(user.getEmpPosUnitName());
}

//如果是重新提交的话 判断下 项目是否存在
if(Objects.nonNull(projectInfo.getId())){
//新申报的项目不允许带项目id
projectInfo.setId(null);
}

//放入文件
projectInfo.setConstructionPlanFile(projectDto.getConstructionPlanFile());
Project constructProject = new Project();
BeanUtils.copyProperties(projectInfo,constructProject);

String regionCode = user.getRegionCode();

WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
.eq(WflowModels::getRegionCode, regionCode)
@@ -123,16 +140,16 @@ public class ConstructionPlanManage {
//如果被禁用了的话 直接跳过 进入到下一个状态
if(model.getIsStop()){
//被禁用了 调2次状态机
stateMachineUtils.pass(projectInfo);
stateMachineUtils.pass(projectInfo);
projectInfo.setUpdateOn(LocalDateTime.now());
projectService.updateById(projectInfo);
stateMachineUtils.pass(constructProject);
stateMachineUtils.pass(constructProject);
constructProject.setUpdateOn(LocalDateTime.now());
projectService.updateById(constructProject);
return "因为建设方案流程被禁用了 直接跳过!";
}

//首先要判断 项目当前状态 是不是 方案待申报
VUtils.isTrue(!ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode().equals(projectInfo.getStatus()) ||
!ProjectStatusEnum.NOT_APPROVED.getCode().equals(projectInfo.getStage()))
// 判断 项目当前状态 是不是 方案待申报
VUtils.isTrue(!ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode().equals(constructProject.getStatus()) ||
!ProjectStatusEnum.NOT_APPROVED.getCode().equals(constructProject.getStage()))
.throwMessage("提交失败 该项目不是 方案待申报状态或者未立项阶段");

ProcessStartParamsVo params = new ProcessStartParamsVo();
@@ -142,20 +159,15 @@ public class ConstructionPlanManage {
//把条件值给放入工作流
defaultDeclaredProjectManage.buildCondition(params, dto);
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode, projectInfo);
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode, constructProject);
String instanceId = processService.newStartProcess(model.getProcessDefId(), model.getFormId(), params, orgModelMap);
log.info("建设方案项目申报成功 【{}】", instanceId);

//保存建设项目
if(dto.getRestart()){
modifyProject(projectInfo, instanceId, projectInfo.getConstructionPlanFile());
}else{
//生成新版本 并且进入下一状态
projectInfo = projectLibManage.saveProjectWithVersionAndPass(projectInfo,instanceId,InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode());
}
// 保存建设项目相关
Project buildProject = projectLibManage.saveConstructProjectInDeclared(projectInfo,instanceId,employeeCode);

//发送给第一个审批人消息
noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId,
noticeManage.sendFirtUser(buildProject,model.getFormName(),instanceId,
WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW);

return instanceId;


+ 122
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java View File

@@ -201,6 +201,28 @@ public class ProjectLibManage {
return project;
}


/**
* 建设方案申报项目时 保存项目信息和其它相关联的信息
* @param projectDto
* @param instanceId
* @param employeeCode
* @return
*/
public Project saveConstructProjectInDeclared(ProjectDTO projectDto, String instanceId,
String employeeCode) {
Project project = saveConstructProjectNewVersion(projectDto,instanceId,employeeCode);
//保存项目和实例的关系
ProjectInst projectInst = new ProjectInst();
projectInst.setProjectId(project.getId());
projectInst.setInstCode(instanceId);
projectInst.setCreatOn(LocalDateTime.now());
projectInst.setUpdateOn(LocalDateTime.now());
projectInst.setInstType(ProjectProcessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS.getCode());
projectInstService.save(projectInst);
return project;
}

/**
* 申报新项目时 保存项目信息和其它相关联的信息
* @param projectDto
@@ -265,6 +287,72 @@ public class ProjectLibManage {
}

/**
* 建设方案申报项目时 保存项目信息和其它相关联的信息
* @param projectDto
* @param instanceId
* @param employeeCode
* @return
*/
public Project saveConstructProjectNewVersion(ProjectDTO projectDto, String instanceId,
String employeeCode) {
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示
try {
Project project = new Project();
//为空 代表是新申报的
if(Objects.isNull(projectDto.getId())){
BeanUtils.copyProperties(projectDto, project);
project.setCreateOn(LocalDateTime.now());
project.setUpdateOn(LocalDateTime.now());
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
project.setInstCode(instanceId);
project.setSponsor(employeeCode);
String projectCode = generateProjectCodeUtil.generateProjectCode(projectDto);
project.setProjectCode(projectCode);
// 标记为建设方案申报
project.setIsConstruct(Boolean.TRUE);
projectService.save(project);
}else{
//否则是重新提交的 新生成一个新版本的项目
project = newProjectWithVersion(projectDto);
if(Objects.nonNull(project)){
project.setInstCode(instanceId);
project.setSponsor(employeeCode);
projectService.updateById(project);
}
}

//保存项目应用
Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication())
? Boolean.TRUE : Boolean.FALSE;
//采取批量删除 批量添加的方式
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectId,project.getId()));
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode,project.getProjectCode()));
if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) {
Project finalProject = project;
List<ProjectApplication> applications = projectDto.getApplicationList().stream().map(application -> {
ProjectApplication projectApplication = new ProjectApplication();
BeanUtils.copyProperties(application, projectApplication);
projectApplication.setId(null);
projectApplication.setProjectId(finalProject.getId());
projectApplication.setProjectCode(finalProject.getProjectCode());
projectApplication.setBuildOrgCode(finalProject.getBuildOrgCode());
projectApplication.setBuildOrgName(finalProject.getBuildOrgName());
return projectApplication;
}).collect(Collectors.toList());
projectApplicationService.saveOrUpdateBatch(applications);
}
return project;
} catch (Exception e) {
log.error("项目信息入库错误 " + e);
throw new BusinessException("项目信息入库错误 :" + e);
}
}


/**
* 在其它项目阶段 保存项目信息和其它相关联的信息
* @param projectDto
* @return
@@ -501,6 +589,40 @@ public class ProjectLibManage {
return project;
}

public Project saveConstructProjectWithVersionAndPass(Project oldProject,String instanceId,Integer instType){
Project project = new Project();
VUtils.isTrue(Objects.isNull(oldProject))
.throwMessage("项目不存在!");
BeanUtil.copyProperties(oldProject,project, CopyOptions.create()
.setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE));
project.setVersion(oldProject.getVersion() + 1);
project.setId(null);
project.setInstCode(instanceId);
project.setCreateOn(LocalDateTime.now());
project.setUpdateOn(LocalDateTime.now());
// 标识保存的项目信息是否为建设方案申报项目
project.setIsConstruct(Boolean.TRUE);
stateMachineUtils.pass(project);

if(projectService.save(project)){
//保存项目和实例的关系
ProjectInst projectInst = new ProjectInst();
projectInst.setProjectId(project.getId());
projectInst.setInstCode(instanceId);
projectInst.setCreatOn(LocalDateTime.now());
projectInst.setUpdateOn(LocalDateTime.now());
projectInst.setInstType(instType);
projectInstService.save(projectInst);

projectService.update(Wrappers.lambdaUpdate(Project.class)
.set(Project::getNewest,Boolean.FALSE)
.ne(Project::getId,project.getId())
.eq(Project::getProjectCode,project.getProjectCode()));
}

return project;
}

/**
* @param projectId 项目详情
* @return com.ningdatech.pmapi.projectlib.model.entity.vo.ProjectDetailVO


+ 46
- 11
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java View File

@@ -15,6 +15,7 @@ import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.pmapi.common.constant.RegionConst;
import com.ningdatech.pmapi.common.enumeration.CommonEnum;
import com.ningdatech.pmapi.projectlib.enumeration.*;
import com.ningdatech.pmapi.sys.model.entity.Region;
import com.ningdatech.pmapi.sys.service.IRegionService;
@@ -24,6 +25,7 @@ import com.ningdatech.pmapi.todocenter.handle.WithDrawHandle;
import com.ningdatech.pmapi.todocenter.model.dto.*;
import com.ningdatech.pmapi.todocenter.model.vo.TodoNumVO;
import com.wflow.contants.HisProInsEndActId;
import com.wflow.workflow.bean.process.ProcessComment;
import com.wflow.workflow.utils.ProcessTaskUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
@@ -36,6 +38,7 @@ import org.flowable.engine.HistoryService;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.TaskService;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.task.Comment;
import org.flowable.task.api.Task;
import org.flowable.task.api.history.HistoricTaskInstance;
import org.flowable.variable.api.history.HistoricVariableInstance;
@@ -1285,8 +1288,14 @@ public class TodoCenterManage {
}

public Long getSealedPdf(SealInfoDTO req) {
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId());
String empPosUnitCode = user.getEmpPosUnitCode();
Long projectId = req.getProjectId();
// 盖章审核意见
String auditOpinion = req.getAuditOpinion();
String auditDate = NdDateUtils.format(LocalDateTime.now(), NdDateUtils.DEFAULT_DATE_TIME_FORMAT);
Project declaredProject = projectService.getById(projectId);
String buildOrgCode = declaredProject.getBuildOrgCode();
String instanceId = declaredProject.getInstCode();
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class)
.eq(ProjectInst::getInstCode, instanceId));
@@ -1301,26 +1310,51 @@ public class TodoCenterManage {
throw new BizException("项目所属区域不存在!");
}
Integer regionLevel = region.getRegionLevel();
// 获取项目申报时是否选择了主管单位和上级条线主管单位
// 主管单位信息
Integer isSuperOrg = declaredProject.getIsSuperOrg();
String superOrgCode = declaredProject.getSuperOrgCode();
// 上级条线主管单位信息
Integer isHigherSuperOrg = declaredProject.getIsHigherSuperOrg();
String higherSuperOrgCode = declaredProject.getHigherSuperOrgCode();
switch (regionLevel) {
// 市级预审
case RegionConst.RL_CITY:
String cityTemplateName = TodoCenterConstant.SealTemplate.CITY_TEMPLATE;
// 设置pdf模板参数
JSONObject cityParamsMap = assemblyPdfParams(declaredProject, cityTemplateName);
// TODO 根据当前盖章单位设置对应的盖章意见与盖章日期
cityParamsMap.put("superOrgOpinion",null);
cityParamsMap.put("superOrgAuditDate",null);
// 盖章审核为主管单位审核
if (superOrgCode.equals(empPosUnitCode)) {
cityParamsMap.put("superOrgOpinion", auditOpinion);
cityParamsMap.put("superOrgAuditDate", auditDate);
}
return getSealedPdf(req, declaredProject,cityTemplateName,cityParamsMap);
// 区县预审
case RegionConst.RL_COUNTY:
String countryTemplateName = TodoCenterConstant.SealTemplate.COUNTRY_TEMPLATE;
// 设置pdf模板参数
JSONObject countryParamsMap = assemblyPdfParams(declaredProject, countryTemplateName);
// TODO 根据当前盖章单位设置对应的盖章意见与盖章日期
countryParamsMap.put("superOrgOpinion",null);
countryParamsMap.put("superOrgAuditDate",null);
countryParamsMap.put("higherOrgOpinion",null);
countryParamsMap.put("higherOrgAuditDate",null);

// 判断当前盖章用户所在单位是本级主管单位还是上级主管单位
if (CommonEnum.YES.getCode().equals(isSuperOrg)){
// 有主管单位信息且登录用户所在单位是主管单位
if (superOrgCode.equals(empPosUnitCode)){
countryParamsMap.put("superOrgOpinion",auditOpinion);
countryParamsMap.put("superOrgAuditDate",auditDate);
}
} else if (CommonEnum.NO.getCode().equals(isSuperOrg)) {
// 没有选主管单位,默认为项目建设单位且登录用户所在单位为项目建设单位
if (buildOrgCode.equals(empPosUnitCode)) {
countryParamsMap.put("superOrgOpinion", auditOpinion);
countryParamsMap.put("superOrgAuditDate", auditDate);
}
} else if (CommonEnum.YES.getCode().equals(isHigherSuperOrg)) {
// 有上级条线主管单位信息且登录用户所在单位是上级条线主管单位
if (higherSuperOrgCode.equals(empPosUnitCode)){
countryParamsMap.put("higherOrgOpinion",auditOpinion);
countryParamsMap.put("higherOrgAuditDate",auditDate);
}
}
return getSealedPdf(req, declaredProject,countryTemplateName, countryParamsMap);
default:
throw new IllegalStateException("Unexpected value: " + regionLevel);
@@ -1331,9 +1365,10 @@ public class TodoCenterManage {
// 设置pdf模板参数
String constructTemplateName = TodoCenterConstant.SealTemplate.CONSTRUCT_TEMPLATE;
JSONObject constructParamsMap = assemblyPdfParams(declaredProject, constructTemplateName);
// 本级主管单位意见、上级主管单位意见
constructParamsMap.put("bigDataBureauOpinion",null);
constructParamsMap.put("bigDataBureauAuditDate",null);
// 审核为指定大数据局盖章
// 获取流程配置的指定单位信息
constructParamsMap.put("bigDataBureauOpinion",auditOpinion);
constructParamsMap.put("bigDataBureauAuditDate",auditDate);
return getSealedPdf(req, declaredProject,constructTemplateName, constructParamsMap);
}
return null;


+ 4
- 0
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/SealInfoDTO.java View File

@@ -34,4 +34,8 @@ public class SealInfoDTO {
*/
private Integer signType;

/**
* 盖章审核意见
*/
private String auditOpinion;
}

Loading…
Cancel
Save