|
|
@@ -8,7 +8,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
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.constant.RegionConst; |
|
|
|
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.organization.model.entity.DingOrganization; |
|
|
|
import com.ningdatech.pmapi.organization.service.IDingOrganizationService; |
|
|
@@ -28,6 +30,7 @@ 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.security.auth.model.UserInfoDetails; |
|
|
|
import com.ningdatech.pmapi.user.util.LoginUserUtil; |
|
|
|
import com.wflow.bean.entity.WflowModels; |
|
|
|
import com.wflow.bean.entity.WflowOrgModels; |
|
|
@@ -79,6 +82,8 @@ public class DeclaredProjectManage { |
|
|
|
|
|
|
|
private final UserInfoHelper userInfoHelper; |
|
|
|
|
|
|
|
private final RegionCacheHelper regionCacheHelper; |
|
|
|
|
|
|
|
/** |
|
|
|
* 新项目 启动实例 |
|
|
|
* |
|
|
@@ -87,10 +92,16 @@ public class DeclaredProjectManage { |
|
|
|
*/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public String startTheProcess(DefaultDeclaredDTO dto) { |
|
|
|
Long userId = LoginUserUtil.getUserId(); |
|
|
|
VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); |
|
|
|
UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); |
|
|
|
Long userId = userInfoDetails.getUserId(); |
|
|
|
VUtils.isTrue(Objects.isNull(userInfoDetails) ||Objects.isNull(userInfoDetails.getUserId())) |
|
|
|
.throwMessage("获取登录用户失败!"); |
|
|
|
|
|
|
|
ProjectDTO projectInfo = dto.getProjectInfo(); |
|
|
|
projectInfo.setAreaCode(userInfoDetails.getRegionCode()); |
|
|
|
projectInfo.setArea(regionCacheHelper.getRegionName(userInfoDetails.getRegionCode(), RegionConst.RL_COUNTY)); |
|
|
|
projectInfo.setBuildOrgCode(userInfoDetails.getOrganizationCode()); |
|
|
|
projectInfo.setBuildOrgName(userInfoDetails.getOrganizationName()); |
|
|
|
|
|
|
|
//如果是重新提交的话 判断下 项目是否存在 |
|
|
|
if(Objects.nonNull(projectInfo.getId())){ |
|
|
@@ -105,7 +116,7 @@ public class DeclaredProjectManage { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String regionCode = projectInfo.getAreaCode(); |
|
|
|
String regionCode = userInfoDetails.getRegionCode(); |
|
|
|
|
|
|
|
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) |
|
|
|
.eq(WflowModels::getRegionCode, regionCode) |
|
|
@@ -138,7 +149,7 @@ public class DeclaredProjectManage { |
|
|
|
log.info("申报项目成功 【{}】", instanceId); |
|
|
|
|
|
|
|
//如果是重新提交的话 判断下 项目是否存在 |
|
|
|
saveOrUpdateProject(dto.getProjectInfo(), instanceId, regionCode,userId); |
|
|
|
saveOrUpdateProject(projectInfo, instanceId,userId); |
|
|
|
|
|
|
|
return instanceId; |
|
|
|
} |
|
|
@@ -152,10 +163,16 @@ public class DeclaredProjectManage { |
|
|
|
*/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public String reStartTheProcess(DefaultDeclaredDTO dto) { |
|
|
|
Long userId = LoginUserUtil.getUserId(); |
|
|
|
VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); |
|
|
|
|
|
|
|
UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); |
|
|
|
VUtils.isTrue(Objects.isNull(userInfoDetails) || Objects.isNull(userInfoDetails.getUserId())) |
|
|
|
.throwMessage("获取登录用户失败!"); |
|
|
|
Long userId = userInfoDetails.getUserId(); |
|
|
|
ProjectDTO projectDto = dto.getProjectInfo(); |
|
|
|
projectDto.setAreaCode(userInfoDetails.getRegionCode()); |
|
|
|
projectDto.setArea(regionCacheHelper.getRegionName(userInfoDetails.getRegionCode(), RegionConst.RL_COUNTY)); |
|
|
|
projectDto.setBuildOrgCode(userInfoDetails.getOrganizationCode()); |
|
|
|
projectDto.setBuildOrgName(userInfoDetails.getOrganizationName()); |
|
|
|
|
|
|
|
VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); |
|
|
|
Project projectInfo = projectService.getById(projectDto.getId()); |
|
|
|
VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); |
|
|
@@ -193,7 +210,7 @@ public class DeclaredProjectManage { |
|
|
|
log.info("重新申报项目成功 【{}】", instanceId); |
|
|
|
|
|
|
|
//保存项目 |
|
|
|
saveOrUpdateProject(projectDto,instanceId,regionCode,userId); |
|
|
|
saveOrUpdateProject(projectDto,instanceId,userId); |
|
|
|
|
|
|
|
return instanceId; |
|
|
|
} |
|
|
@@ -205,7 +222,7 @@ public class DeclaredProjectManage { |
|
|
|
* @param instanceId |
|
|
|
*/ |
|
|
|
private void saveOrUpdateProject(ProjectDTO projectDto, String instanceId, |
|
|
|
String regionCode,Long userId) { |
|
|
|
Long userId) { |
|
|
|
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示 |
|
|
|
try { |
|
|
|
//保存项目表信息 |
|
|
@@ -213,7 +230,6 @@ public class DeclaredProjectManage { |
|
|
|
BeanUtils.copyProperties(projectDto, project); |
|
|
|
project.setCreateOn(LocalDateTime.now()); |
|
|
|
project.setUpdateOn(LocalDateTime.now()); |
|
|
|
project.setAreaCode(regionCode); |
|
|
|
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); |
|
|
|
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); |
|
|
|
project.setInstCode(instanceId); |
|
|
@@ -292,10 +308,15 @@ public class DeclaredProjectManage { |
|
|
|
*/ |
|
|
|
public Long saveToDraft(ProjectDraftSaveDTO dto) { |
|
|
|
Long userId = LoginUserUtil.getUserId(); |
|
|
|
UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); |
|
|
|
|
|
|
|
ProjectDTO projectInfo = dto.getProjectInfo(); |
|
|
|
ProjectDraft draft = new ProjectDraft(); |
|
|
|
BeanUtils.copyProperties(projectInfo, draft); |
|
|
|
draft.setUserId(dto.getUser().getUserId()); |
|
|
|
draft.setBuildOrgCode(userInfoDetails.getOrganizationCode()); |
|
|
|
draft.setAreaCode(userInfoDetails.getRegionCode()); |
|
|
|
|
|
|
|
if(CollUtil.isNotEmpty(projectInfo.getDynamicForm())){ |
|
|
|
draft.setDynamicForm(JSON.toJSONString(projectInfo.getDynamicForm())); |
|
|
|
} |
|
|
|