|
|
@@ -1,5 +1,6 @@ |
|
|
|
package com.ningdatech.pmapi.projectdeclared.manage; |
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.TypeReference; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
@@ -10,12 +11,14 @@ import com.ningdatech.pmapi.common.enums.ProjectProessStageEnum; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.entity.ProjectDraft; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.entity.dto.DeclaredProjectDto; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.entity.dto.DeclaredProjectListParamDto; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.entity.dto.ProjectConditionDto; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.entity.dto.ProjectDraftSaveDto; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.entity.vo.ProjectDeclaredDetailVO; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.entity.vo.ProjectDeclaredListItemVO; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.entity.vo.ProjectDraftVo; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.service.IProjectDraftService; |
|
|
|
import com.ningdatech.pmapi.projectlib.enums.ProjectStatusEnum; |
|
|
|
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.service.IProjectApplicationService; |
|
|
@@ -144,17 +147,34 @@ public class DeclaredProjectManage { |
|
|
|
params.setUser(dto.getUser()); |
|
|
|
params.setProcessUsers(Collections.emptyMap()); |
|
|
|
//放入条件判断的项目字段 |
|
|
|
dto.getFormData().putAll( |
|
|
|
JSON.parseObject(JSON.toJSONString(dto.getProjectInfo()), new TypeReference<Map<String, Object>>() { |
|
|
|
})); |
|
|
|
ProjectConditionDto conditionDto = new ProjectConditionDto(); |
|
|
|
BeanUtils.copyProperties(dto.getProjectInfo(),conditionDto); |
|
|
|
if(Objects.nonNull(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); |
|
|
|
String instanceId = processService.startProcess(model.getProcessDefId(), params); |
|
|
|
log.info("申报项目成功 【{}】",instanceId); |
|
|
|
|
|
|
|
//保存项目 |
|
|
|
saveProject(dto.getProjectInfo(),instanceId,regionCode); |
|
|
|
|
|
|
|
return instanceId; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 申报项目 时 新增项目到项目库 |
|
|
|
* @param projectDto |
|
|
|
* @param instanceId |
|
|
|
*/ |
|
|
|
private void saveProject(ProjectDto projectDto,String instanceId,String regionCode) { |
|
|
|
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示 |
|
|
|
try{ |
|
|
|
//保存项目表信息 |
|
|
|
Project project = new Project(); |
|
|
|
BeanUtils.copyProperties(dto.getProjectInfo(),project); |
|
|
|
BeanUtils.copyProperties(projectDto,project); |
|
|
|
project.setCreateOn(LocalDateTime.now()); |
|
|
|
project.setUpdateOn(LocalDateTime.now()); |
|
|
|
project.setAreaCode(regionCode); |
|
|
@@ -162,12 +182,20 @@ public class DeclaredProjectManage { |
|
|
|
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); |
|
|
|
project.setInstCode(instanceId); |
|
|
|
projectService.save(project); |
|
|
|
//保存项目应用 |
|
|
|
if(CollUtil.isNotEmpty(projectDto.getApplicationList())){ |
|
|
|
List<ProjectApplication> applications = projectDto.getApplicationList().stream().map(application -> { |
|
|
|
ProjectApplication projectApplication = new ProjectApplication(); |
|
|
|
BeanUtils.copyProperties(application, projectApplication); |
|
|
|
projectApplication.setProjectId(project.getId()); |
|
|
|
return projectApplication; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
projectApplicationService.saveBatch(applications); |
|
|
|
} |
|
|
|
}catch (Exception e){ |
|
|
|
log.error("项目信息入库错误 ",e); |
|
|
|
throw new BusinessException("项目信息入库错误 请注意格式"); |
|
|
|
throw new BusinessException("项目信息入库错误 :" + e.getMessage()); |
|
|
|
} |
|
|
|
|
|
|
|
return instanceId; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|