diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java index 4ba36d235d..2730d87941 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java @@ -504,6 +504,7 @@ public class IssueServiceImpl extends BaseServiceImpl imp //3:调用gov-project服务,新增项目各业务表初始数据 Result resultDTO = govProjectFeignClient.issueShiftProject(formDTO); if (!resultDTO.success() || null == resultDTO.getData()) { + logger.error(resultDTO.getInternalMsg()); throw new RenException(IssueConstant.GOV_PRJECT_EXCEPTION); } IssueProjectResultDTO issueProjectResultDTO = resultDTO.getData(); diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java index a2d77e8446..fd8934060a 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java @@ -113,4 +113,9 @@ public interface ProjectConstant { * 获取项目节点数据失败 */ String SELECT_process_EXCEPTION = "获取项目节点数据失败"; + /** + * 议题转项目已存在项目数据,不能重复转 + * 议题转项目 项目服务数据入库成功,议题数据更新或发送消息失败导致议题数据可以回滚,项目服务数据不能回滚 + */ + String SAVE_PROJECT_EXCEPTION = "已存在项目数据,不能重复转项目"; } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java index 3b58c435b7..a45b46bb0a 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java @@ -103,4 +103,12 @@ public interface ProjectDao extends BaseDao { * @Description 获取客户下已结案项目列表,按结案时间倒序 **/ List selectClosedProjectList(LatestListFormDTO formDTO); + + /** + * @param projectDTO + * @return + * @Author sun + * @Description 根据客户Id、机关Id、议题Id查询项目数据是否存在 + **/ + List selectProjectList(ProjectDTO projectDTO); } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java index 29a964851f..4ec3eacda5 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java @@ -467,6 +467,17 @@ public class ProjectServiceImpl extends BaseServiceImpl staffList = formDTO.getStaffList(); IssueDTO issueDTO = formDTO.getIssueDTO(); + //0.因项目还未添加分布式事务,议题转项目,如果项目数据入库成功议题数据也修改成功但是消息发送失败时则议题数据可以回滚但项目服务的数据不能回滚 + //先根据客户Id机关Id议题Id查询项目表是否已存在,存在则说明之前转过切失败了,这样的数据不能再操作了,只能操作数据库,将项目表和项目进展表数据清除 + ProjectDTO projectDTO = new ProjectDTO(); + projectDTO.setCustomerId(issueDTO.getCustomerId()); + projectDTO.setAgencyId(issueDTO.getOrgId()); + projectDTO.setOrigin(ProjectConstant.ISSUE); + projectDTO.setOriginId(issueDTO.getId()); + List listProject = baseDao.selectProjectList(projectDTO); + if (null != listProject && listProject.size() > NumConstant.ZERO) { + throw new RenException(ProjectConstant.SAVE_PROJECT_EXCEPTION); + } //1:调用gov-org服务,获取所有勾选人员以及议题数据对应的组织信息、部门信息、网格信息用于对处理部门和ORG_ID_PATH字段的赋值使用 List agencyIdList = staffList.stream().map(TickStaffFormDTO::getAgencyId).collect(Collectors.toList()); agencyIdList.add(issueDTO.getOrgId()); diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml index 0dad21111b..548eb53128 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml @@ -165,4 +165,22 @@ ORDER BY p.created_time DESC + + \ No newline at end of file