diff --git a/kingbasesql/project.sql b/kingbasesql/project.sql index e69de29..7bcbfbf 100644 --- a/kingbasesql/project.sql +++ b/kingbasesql/project.sql @@ -0,0 +1,2 @@ +ALTER TABLE PUBLIC."nd_project" ADD "org_credit_code" VARCHAR(60); +comment ON COLUMN nd_project.org_credit_code IS '企业统一信息代码'; \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java index f8cd709..2bf9ab0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java @@ -5,6 +5,7 @@ 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.constant.RegionConst; import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; import com.ningdatech.pmapi.common.helper.UserInfoHelper; import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; @@ -21,6 +22,7 @@ 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.security.auth.model.UserInfoDetails; import com.ningdatech.pmapi.user.util.LoginUserUtil; import com.wflow.bean.entity.WflowModels; import com.wflow.exception.BusinessException; @@ -76,8 +78,10 @@ public class ConstructionPlanManage { */ @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 projectDto = dto.getProjectInfo(); VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java index 0226803..3fec8c1 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java @@ -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())); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ProjectDraft.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ProjectDraft.java index cd3f80a..5463c22 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ProjectDraft.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ProjectDraft.java @@ -70,6 +70,9 @@ public class ProjectDraft implements Serializable { private String buildOrgName; @ApiModelProperty("建设单位统一社会信用代码") + private String orgCreditCode; + + @ApiModelProperty("公司编码code") private String buildOrgCode; @ApiModelProperty("建设单位浙政钉ID") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDeclaredDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDeclaredDetailVO.java index d9667b8..1b795d0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDeclaredDetailVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDeclaredDetailVO.java @@ -58,7 +58,10 @@ public class ProjectDeclaredDetailVO { private String buildUnitName; @ApiModelProperty("建设单位统一社会信用代码") - private String buildUnitCode; + private String orgCreditCode; + + @ApiModelProperty("公司编码code") + private String buildOrgCode; @ApiModelProperty("建设单位浙政钉ID") private String buildUnitZheJiangGovernmentDingId; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDraftVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDraftVO.java index cf7abb8..55ae7f2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDraftVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDraftVO.java @@ -71,6 +71,9 @@ public class ProjectDraftVO implements Serializable { private String buildOrgName; @ApiModelProperty("建设单位统一社会信用代码") + private String orgCreditCode; + + @ApiModelProperty("公司编码code") private String buildOrgCode; @ApiModelProperty("建设单位浙政钉ID") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java index e399fff..8327f3d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java @@ -56,6 +56,9 @@ public class ProjectDTO implements Serializable { private String buildOrgName; @ApiModelProperty("建设单位统一社会信用代码") + private String orgCreditCode; + + @ApiModelProperty("公司编码code") private String buildOrgCode; @ApiModelProperty("建设单位浙政钉ID") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java index f8845d7..4b466ea 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java @@ -63,6 +63,9 @@ public class Project implements Serializable { private String buildOrgName; @ApiModelProperty("建设单位统一社会信用代码") + private String orgCreditCode; + + @ApiModelProperty("公司编码code") private String buildOrgCode; @ApiModelProperty("建设单位浙政钉ID") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java index b4f5191..f9fdb5e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java @@ -64,6 +64,9 @@ public class ProjectDetailVO { private String buildOrgName; @ApiModelProperty("建设单位统一社会信用代码") + private String orgCreditCode; + + @ApiModelProperty("公司编码code") private String buildOrgCode; @ApiModelProperty("建设单位浙政钉ID")