From 97f4d4637293562732d578f7ce7334ca65521090 Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 17 Nov 2020 14:31:08 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E7=94=A8feign=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=20=E8=BF=94=E5=9B=9E=E9=94=99=E8=AF=AF?= =?UTF-8?q?=EF=BC=8C=E5=88=9B=E5=BB=BA=E8=AE=AE=E9=A2=98=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ResiTopicServiceImpl.java | 68 +++++++++---------- .../epmet/modules/utils/ModuleConstant.java | 4 +- 2 files changed, 37 insertions(+), 35 deletions(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java index 1a5d8964a3..6e34af14da 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java @@ -18,7 +18,6 @@ package com.epmet.modules.topic.service.impl; - import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; @@ -75,9 +74,9 @@ import com.epmet.resi.group.dto.member.form.RemoveMemberFormDTO; import com.epmet.resi.group.dto.member.result.ResiGroupMemberInfoRedisResultDTO; import com.epmet.resi.group.dto.topic.ResiTopicDTO; import com.epmet.resi.group.dto.topic.TopicInfoDTO; -import com.epmet.resi.group.dto.topic.form.*; import com.epmet.resi.group.dto.topic.form.CheckTopicPublisherFormDTO; import com.epmet.resi.group.dto.topic.form.GovTopicIssueInfoFormDTO; +import com.epmet.resi.group.dto.topic.form.*; import com.epmet.resi.group.dto.topic.result.*; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -1156,48 +1155,49 @@ public class ResiTopicServiceImpl extends BaseServiceImpl issueResult = govIssueFeignClient.issueShiftedToTopic(issueInfo); + if (issueResult == null || !issueResult.success() || StringUtils.isBlank(issueResult.getData())) { + throw new RenException(ModuleConstant.CREATE_ISSUE_ERROR); + } //5.修改话题shiftIssue字段 - if(issueResult.success() && StringUtils.isNotBlank(issueResult.getData())){ - ResiTopicEntity topic2Upd = new ResiTopicEntity(); - topic2Upd.setId(topicTurnIssueFromDTO.getTopicId()); - topic2Upd.setUpdatedBy(topicTurnIssueFromDTO.getUserId()); - topic2Upd.setShiftIssue(Boolean.TRUE); - topic2Upd.setIssueId(issueResult.getData()); - topic2Upd.setUpdatedTime(now); - int topicResult = baseDao.updateOne(topic2Upd); - //6.新增话题操作记录 - if(topicResult == NumConstant.ONE) { - ResiTopicOperationEntity operation = new ResiTopicOperationEntity(); - operation.setCreatedTime(now); - operation.setCreatedBy(topicTurnIssueFromDTO.getUserId()); - operation.setTopicId(topicTurnIssueFromDTO.getTopicId()); - operation.setOperationType(ModuleConstant.TOPIC_OPERATION_TYPE_SHIFT_ISSUE); - int operationResult = resiTopicOperationDao.insertOneByParams(operation); - if(operationResult != NumConstant.ONE){ - logger.warn(ModuleConstant.FAILURE_TO_ADD_TOPIC_OPERATION); - } - } - //7.更新组统计信息 议题数量+1 - resiGroupStatisticalDao.incryTotalIssues(group.getGroupId()); - if(null != groupCache && null != groupCache.getGroupStatisticalInfo()){ - groupCache.getGroupStatisticalInfo().setTotalIssues( - null == groupCache.getGroupStatisticalInfo().getTotalIssues() ? NumConstant.ONE - : groupCache.getGroupStatisticalInfo().getTotalIssues() + NumConstant.ONE - ); - resiGroupRedis.set(groupCache); - } - logger.warn(ModuleConstant.FAILURE_TO_UPDATE_TOPIC); + ResiTopicEntity topic2Upd = new ResiTopicEntity(); + topic2Upd.setId(topicTurnIssueFromDTO.getTopicId()); + topic2Upd.setUpdatedBy(topicTurnIssueFromDTO.getUserId()); + topic2Upd.setShiftIssue(Boolean.TRUE); + topic2Upd.setIssueId(issueResult.getData()); + topic2Upd.setUpdatedTime(now); + int topicResult = baseDao.updateOne(topic2Upd); + //6.新增话题操作记录 + if (topicResult == NumConstant.ONE) { + ResiTopicOperationEntity operation = new ResiTopicOperationEntity(); + operation.setCreatedTime(now); + operation.setCreatedBy(topicTurnIssueFromDTO.getUserId()); + operation.setTopicId(topicTurnIssueFromDTO.getTopicId()); + operation.setOperationType(ModuleConstant.TOPIC_OPERATION_TYPE_SHIFT_ISSUE); + int operationResult = resiTopicOperationDao.insertOneByParams(operation); + if (operationResult != NumConstant.ONE) { + logger.warn(ModuleConstant.FAILURE_TO_ADD_TOPIC_OPERATION); + } + } + //7.更新组统计信息 议题数量+1 + resiGroupStatisticalDao.incryTotalIssues(group.getGroupId()); + if (null != groupCache && null != groupCache.getGroupStatisticalInfo()) { + groupCache.getGroupStatisticalInfo().setTotalIssues( + null == groupCache.getGroupStatisticalInfo().getTotalIssues() ? NumConstant.ONE + : groupCache.getGroupStatisticalInfo().getTotalIssues() + NumConstant.ONE + ); + resiGroupRedis.set(groupCache); } + logger.warn(ModuleConstant.FAILURE_TO_UPDATE_TOPIC); } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java index 094c58bda7..9fa1359bdf 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java @@ -327,5 +327,7 @@ public interface ModuleConstant extends Constant { String FIELD_OPERATION_TYPE = "OPERATION_TYPE"; - String CLOSED_TOPIC_REASON_PREFIX="话题已关闭:"; + String CLOSED_TOPIC_REASON_PREFIX = "话题已关闭:"; + + String CREATE_ISSUE_ERROR = "创建议题失败"; }