Browse Source

因分布式事务问题,议题转项目接口添加数据判断

dev_shibei_match
sunyuchao 5 years ago
parent
commit
4686aafc9e
  1. 1
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java
  2. 5
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java
  3. 8
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java
  4. 11
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java
  5. 18
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml

1
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<IssueDao, IssueEntity> imp
//3:调用gov-project服务,新增项目各业务表初始数据
Result<IssueProjectResultDTO> 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();

5
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 = "已存在项目数据,不能重复转项目";
}

8
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java

@ -103,4 +103,12 @@ public interface ProjectDao extends BaseDao<ProjectEntity> {
* @Description 获取客户下已结案项目列表按结案时间倒序
**/
List<LatestListResultDTO> selectClosedProjectList(LatestListFormDTO formDTO);
/**
* @param projectDTO
* @return
* @Author sun
* @Description 根据客户Id机关Id议题Id查询项目数据是否存在
**/
List<ProjectDTO> selectProjectList(ProjectDTO projectDTO);
}

11
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<ProjectDao, ProjectEntit
IssueProjectResultDTO issueProjectResultDTO = new IssueProjectResultDTO();
List<TickStaffFormDTO> 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<ProjectDTO> 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<String> agencyIdList = staffList.stream().map(TickStaffFormDTO::getAgencyId).collect(Collectors.toList());
agencyIdList.add(issueDTO.getOrgId());

18
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml

@ -165,4 +165,22 @@
ORDER BY p.created_time DESC
</select>
<select id="selectProjectList" resultType="com.epmet.dto.ProjectDTO">
SELECT
id,
customer_id,
agency_id,
origin,
origin_id,
title
FROM
project
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND agency_id = #{agencyId}
AND origin = #{origin}
AND origin_id = #{originId}
</select>
</mapper>
Loading…
Cancel
Save