Browse Source

发布的议题,议题转项目接口调整

master
yinzuomei 3 years ago
parent
commit
04564196b5
  1. 2
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueDTO.java
  2. 5
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/UserMessageConstant.java
  3. 2
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueEntity.java
  4. 115
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java
  5. 55
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java

2
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueDTO.java

@ -49,7 +49,7 @@ public class IssueDTO implements Serializable {
private String issueStatus;
/**
* 来源类型 eg:resi_topic
* 来源类型 话题resi_topic直接立议题issue
*/
private String sourceType;

5
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/UserMessageConstant.java

@ -36,4 +36,9 @@ public interface UserMessageConstant {
*/
String PROJECT_RESOLVED_MSG = "您收到一条【%s】的新信息,请您尽快处理。";
/**
* 议题转项目消息模板
*/
String PUB_ISSUE_SHIFT_PROJECT_MSG = "您发表的议题\"%s\"的问题,已由%s部门处理,请查看。";
}

2
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueEntity.java

@ -43,7 +43,7 @@ public class IssueEntity extends BaseEpmetEntity {
private String issueStatus;
/**
* 来源类型 eg:resi_topic
* 来源类型 话题resi_topic直接立议题issue
*/
private String sourceType;

115
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java

@ -1025,18 +1025,21 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp
//因需要保证议题表中的转项目时间与创建项目时间一致 因此先新增项目数据再更新议题数据
//2:调用resi-group查询话题创建人数据(目前议题来源只有来自话题),为了到项目服务初始数据以及发送消息使用
Result<ResiTopicDTO> resultTopicDTO = resiGroupFeignClient.getTopicById(entity.getSourceId());
if (!resultTopicDTO.success() || null == resultTopicDTO.getData()) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),IssueConstant.SELECT_TOPIC_EXCEPTION,IssueConstant.SELECT_TOPIC_EXCEPTION);
if("resi_topic".equals(entity.getSourceType())){
Result<ResiTopicDTO> resultTopicDTO = resiGroupFeignClient.getTopicById(entity.getSourceId());
if (!resultTopicDTO.success() || null == resultTopicDTO.getData()) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),IssueConstant.SELECT_TOPIC_EXCEPTION,IssueConstant.SELECT_TOPIC_EXCEPTION);
}
ResiTopicDTO topicDTO = resultTopicDTO.getData();
formDTO.setTopicDTO(topicDTO);
}
ResiTopicDTO topicDTO = resultTopicDTO.getData();
formDTO.setTopicDTO(topicDTO);
//3:调用gov-project服务,新增项目各业务表初始数据
formDTO.setCategoryList(categoryList);
formDTO.setGridId(entity.getGridId());
List<IssueTagsDTO> tagList = issueTagsService.getTagsByIssue(formDTO.getIssueId());
formDTO.setTagList(tagList);
// 议题转项目!!!!!!!!!!!!在这步
Result<IssueProjectResultDTO> resultDTO = govProjectFeignClient.issueShiftProject(formDTO);
if (!resultDTO.success() || null == resultDTO.getData()) {
logger.error(resultDTO.getInternalMsg());
@ -1124,32 +1127,50 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp
List<UserMessageFormDTO> msgList = new ArrayList<>();
//1:创建话题发起人、议题发表人消息对象
UserMessageFormDTO msgDTO = new UserMessageFormDTO();
msgDTO.setCustomerId(entity.getCustomerId());
msgDTO.setGridId(entity.getGridId());
msgDTO.setApp(AppClientConstant.APP_RESI);
msgDTO.setTitle(UserMessageConstant.ISSUE_TITLE);
String topicIssueMessage = String.format(UserMessageConstant.ISSUE_SHIFT_PROJECT_MSG, formDTO.getTopicDTO().getTopicContent(), issueProjectResultDTO.getOrgName());
msgDTO.setMessageContent(topicIssueMessage);
msgDTO.setReadFlag(ReadFlagConstant.UN_READ);
msgDTO.setUserId(formDTO.getTopicDTO().getCreatedBy());
if ("resi_topic".equals(entity.getSourceType()) && null != formDTO.getTopicDTO()) {
UserMessageFormDTO msgDTO = new UserMessageFormDTO();
msgDTO.setCustomerId(entity.getCustomerId());
msgDTO.setGridId(entity.getGridId());
msgDTO.setApp(AppClientConstant.APP_RESI);
msgDTO.setTitle(UserMessageConstant.ISSUE_TITLE);
String topicIssueMessage = String.format(UserMessageConstant.ISSUE_SHIFT_PROJECT_MSG, formDTO.getTopicDTO().getTopicContent(), issueProjectResultDTO.getOrgName());
msgDTO.setMessageContent(topicIssueMessage);
msgDTO.setReadFlag(ReadFlagConstant.UN_READ);
msgDTO.setUserId(formDTO.getTopicDTO().getCreatedBy());
//21.09.10:记录消息类型和对应的业务id
msgDTO.setMessageType(UserMessageTypeConstant.ISSUE_SHIFT_PROJECT);
msgDTO.setTargetId(entity.getId());
//21.09.10:记录消息类型和对应的业务id
msgDTO.setMessageType(UserMessageTypeConstant.ISSUE_SHIFT_PROJECT);
msgDTO.setTargetId(entity.getId());
msgList.add(msgDTO);
//话题人和议题人是同一个人时则只发送一条居民消息
if (!formDTO.getTopicDTO().getCreatedBy().equals(entity.getCreatedBy())) {
UserMessageFormDTO msgIssue = ConvertUtils.sourceToTarget(msgDTO, UserMessageFormDTO.class);
msgIssue.setUserId(entity.getCreatedBy());
msgList.add(msgDTO);
//21.09.10:记录消息类型和对应的业务id
msgIssue.setMessageType(UserMessageTypeConstant.ISSUE_SHIFT_PROJECT);
msgIssue.setTargetId(entity.getId());
//话题人和议题人是同一个人时则只发送一条居民消息
if (!formDTO.getTopicDTO().getCreatedBy().equals(entity.getCreatedBy())) {
UserMessageFormDTO msgIssue = ConvertUtils.sourceToTarget(msgDTO, UserMessageFormDTO.class);
msgIssue.setUserId(entity.getCreatedBy());
msgList.add(msgIssue);
//21.09.10:记录消息类型和对应的业务id
msgIssue.setMessageType(UserMessageTypeConstant.ISSUE_SHIFT_PROJECT);
msgIssue.setTargetId(entity.getId());
msgList.add(msgIssue);
}
}else{
//居民端发布的议题,只给议题发布人发送消息
UserMessageFormDTO msgDTO = new UserMessageFormDTO();
msgDTO.setCustomerId(entity.getCustomerId());
msgDTO.setGridId(entity.getGridId());
msgDTO.setApp(AppClientConstant.APP_RESI);
msgDTO.setTitle(UserMessageConstant.ISSUE_TITLE);
String issueMessage = String.format(UserMessageConstant.PUB_ISSUE_SHIFT_PROJECT_MSG, entity.getIssueTitle(), issueProjectResultDTO.getOrgName());
msgDTO.setMessageContent(issueMessage);
msgDTO.setReadFlag(ReadFlagConstant.UN_READ);
msgDTO.setUserId(entity.getCreatedBy());
msgDTO.setMessageType(UserMessageTypeConstant.ISSUE_SHIFT_PROJECT);
msgDTO.setTargetId(entity.getId());
msgList.add(msgDTO);
}
//2:创建项目工作人员消息对象
String projectStaffMessage = String.format(UserMessageConstant.PROJECT_RESOLVED_MSG, entity.getIssueTitle());
//所选人员如果即在部门下又在网格下则只发一条消息
@ -1181,20 +1202,34 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp
*/
private Result wxmpShiftProjectMessage(IssueProjectResultDTO issueProjectResultDTO, ShiftProjectFormDTO formDTO, IssueEntity entity) {
List<WxSubscribeMessageFormDTO> msgList = new ArrayList<>();
//1:创建话题发起人、议题发表人消息对象
WxSubscribeMessageFormDTO msgDTO = new WxSubscribeMessageFormDTO();
msgDTO.setCustomerId(entity.getCustomerId());
msgDTO.setClientType(AppClientConstant.APP_RESI);
msgDTO.setUserId(formDTO.getTopicDTO().getCreatedBy());
msgDTO.setBehaviorType(UserMessageConstant.WXMP_ISSUE_TITLE);
String topicIssueMessage = String.format(UserMessageConstant.ISSUE_SHIFT_PROJECT_MSG, formDTO.getTopicDTO().getTopicContent(), issueProjectResultDTO.getOrgName());
msgDTO.setMessageContent(topicIssueMessage);
msgDTO.setMessageTime(new Date());
msgDTO.setGridId(entity.getGridId());
msgList.add(msgDTO);
//话题人和议题人是同一个人时则只发送一条居民消息
if (!formDTO.getTopicDTO().getCreatedBy().equals(entity.getCreatedBy())) {
WxSubscribeMessageFormDTO msgIssue = ConvertUtils.sourceToTarget(msgDTO, WxSubscribeMessageFormDTO.class);
if ("resi_topic".equals(entity.getSourceType()) && null != formDTO.getTopicDTO()) {
//1:创建话题发起人、议题发表人消息对象
WxSubscribeMessageFormDTO msgDTO = new WxSubscribeMessageFormDTO();
msgDTO.setCustomerId(entity.getCustomerId());
msgDTO.setClientType(AppClientConstant.APP_RESI);
msgDTO.setUserId(formDTO.getTopicDTO().getCreatedBy());
msgDTO.setBehaviorType(UserMessageConstant.WXMP_ISSUE_TITLE);
String topicIssueMessage = String.format(UserMessageConstant.ISSUE_SHIFT_PROJECT_MSG, formDTO.getTopicDTO().getTopicContent(), issueProjectResultDTO.getOrgName());
msgDTO.setMessageContent(topicIssueMessage);
msgDTO.setMessageTime(new Date());
msgDTO.setGridId(entity.getGridId());
msgList.add(msgDTO);
//话题人和议题人是同一个人时则只发送一条居民消息
if (!formDTO.getTopicDTO().getCreatedBy().equals(entity.getCreatedBy())) {
WxSubscribeMessageFormDTO msgIssue = ConvertUtils.sourceToTarget(msgDTO, WxSubscribeMessageFormDTO.class);
msgIssue.setUserId(entity.getCreatedBy());
msgList.add(msgIssue);
}
}else{
//只给议题发布人发送微信消息
WxSubscribeMessageFormDTO msgIssue = new WxSubscribeMessageFormDTO();
msgIssue.setCustomerId(entity.getCustomerId());
msgIssue.setClientType(AppClientConstant.APP_RESI);
msgIssue.setBehaviorType(UserMessageConstant.WXMP_ISSUE_TITLE);
String topicIssueMessage = String.format(UserMessageConstant.PUB_ISSUE_SHIFT_PROJECT_MSG, entity.getIssueTitle(), issueProjectResultDTO.getOrgName());
msgIssue.setMessageContent(topicIssueMessage);
msgIssue.setMessageTime(new Date());
msgIssue.setGridId(entity.getGridId());
msgIssue.setUserId(entity.getCreatedBy());
msgList.add(msgIssue);
}

55
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java

@ -1186,9 +1186,15 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
projectEntity.setStatus(ProjectConstant.PENDING);
projectEntity.setOrgIdPath(issueDTO.getOrgIdPath());
projectEntity.setGridId(formDTO.getGridId());
projectEntity.setLocateAddress(null == formDTO.getTopicDTO().getAddress() ? "" : formDTO.getTopicDTO().getAddress());
projectEntity.setLocateLongitude(null == formDTO.getTopicDTO().getLongitude() ? "" : formDTO.getTopicDTO().getLongitude());
projectEntity.setLocateDimension(null == formDTO.getTopicDTO().getDimension() ? "" : formDTO.getTopicDTO().getDimension());
if ("resi_topic".equals(formDTO.getIssueDTO().getSourceType())) {
projectEntity.setLocateAddress(null == formDTO.getTopicDTO().getAddress() ? "" : formDTO.getTopicDTO().getAddress());
projectEntity.setLocateLongitude(null == formDTO.getTopicDTO().getLongitude() ? "" : formDTO.getTopicDTO().getLongitude());
projectEntity.setLocateDimension(null == formDTO.getTopicDTO().getDimension() ? "" : formDTO.getTopicDTO().getDimension());
} else {
projectEntity.setLocateAddress(null == formDTO.getIssueDTO().getAddress() ? "" : formDTO.getIssueDTO().getAddress());
projectEntity.setLocateLongitude(null == formDTO.getIssueDTO().getLongitude() ? "" : formDTO.getIssueDTO().getLongitude());
projectEntity.setLocateDimension(null == formDTO.getIssueDTO().getLatitude() ? "" : formDTO.getIssueDTO().getLatitude());
}
baseDao.insert(projectEntity);
//3:项目处理进展表新增数据
@ -1277,20 +1283,35 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
//5:项目相关人员表初始数据
List<ProjectRelatedPersonnelEntity> list = new ArrayList<>();
ProjectRelatedPersonnelEntity entity1 = new ProjectRelatedPersonnelEntity();
entity1.setCustomerId(issueDTO.getCustomerId());
entity1.setProjectId(projectEntity.getId());
entity1.setApp(AppClientConstant.APP_RESI);
entity1.setGridId(issueDTO.getGridId());
entity1.setUserId(formDTO.getTopicDTO().getCreatedBy());
entity1.setSourceType(AppClientConstant.TOPIC);
entity1.setSourceId(formDTO.getTopicDTO().getId());
ProjectRelatedPersonnelEntity entity2 = ConvertUtils.sourceToTarget(entity1,ProjectRelatedPersonnelEntity.class);
entity2.setUserId(issueDTO.getCreatedBy());
entity2.setSourceType(AppClientConstant.ISSUE);
entity2.setSourceId(issueDTO.getId());
list.add(entity1);
list.add(entity2);
if("resi_topic".equals(formDTO.getIssueDTO().getSourceType())){
//话题
ProjectRelatedPersonnelEntity topic = new ProjectRelatedPersonnelEntity();
topic.setCustomerId(issueDTO.getCustomerId());
topic.setProjectId(projectEntity.getId());
topic.setApp(AppClientConstant.APP_RESI);
topic.setGridId(issueDTO.getGridId());
topic.setUserId(formDTO.getTopicDTO().getCreatedBy());
topic.setSourceType(AppClientConstant.TOPIC);
topic.setSourceId(formDTO.getTopicDTO().getId());
list.add(topic);
//议题
ProjectRelatedPersonnelEntity issue = ConvertUtils.sourceToTarget(topic,ProjectRelatedPersonnelEntity.class);
issue.setUserId(issueDTO.getCreatedBy());
issue.setSourceType(AppClientConstant.ISSUE);
issue.setSourceId(issueDTO.getId());
list.add(issue);
}else{
//只插入议题
ProjectRelatedPersonnelEntity issue = new ProjectRelatedPersonnelEntity();
issue.setCustomerId(issueDTO.getCustomerId());
issue.setProjectId(projectEntity.getId());
issue.setApp(AppClientConstant.APP_RESI);
issue.setGridId(issueDTO.getGridId());
issue.setUserId(formDTO.getIssueDTO().getCreatedBy());
issue.setSourceType(AppClientConstant.ISSUE);
issue.setSourceId(formDTO.getIssueDTO().getId());
list.add(issue);
}
projectRelatedPersonnelService.insertBatch(list);
//项目分类和标签表初始数据

Loading…
Cancel
Save