|
|
@ -28,13 +28,17 @@ import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.redis.RedisKeys; |
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.dto.form.IssueInitiatorFormDTO; |
|
|
|
import com.epmet.dto.form.UserResiInfoListFormDTO; |
|
|
|
import com.epmet.dto.CustomerGridDTO; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.result.CommonDataFilterResultDTO; |
|
|
|
import com.epmet.dto.result.IssueInitiatorResultDTO; |
|
|
|
import com.epmet.dto.result.UserResiInfoResultDTO; |
|
|
|
import com.epmet.modules.constant.GroupMemberConstant; |
|
|
|
import com.epmet.modules.feign.EpmetUserFeignClient; |
|
|
|
import com.epmet.modules.feign.GovIssueFeignClient; |
|
|
|
import com.epmet.modules.feign.GovOrgFeignClient; |
|
|
|
import com.epmet.modules.group.dao.ResiGroupDao; |
|
|
|
import com.epmet.modules.group.dao.ResiGroupStatisticalDao; |
|
|
|
import com.epmet.modules.group.entity.ResiGroupEntity; |
|
|
@ -63,14 +67,8 @@ 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.ResiTopicOperationFormDTO; |
|
|
|
import com.epmet.resi.group.dto.topic.form.ResiTopicPageFormDTO; |
|
|
|
import com.epmet.resi.group.dto.topic.form.ResiTopicPublishFormDTO; |
|
|
|
import com.epmet.resi.group.dto.topic.form.TopicInfoFormDTO; |
|
|
|
import com.epmet.resi.group.dto.topic.result.ResiTopicDetailResultDTO; |
|
|
|
import com.epmet.resi.group.dto.topic.result.ResiTopicIncludeIssueDetailResultDTO; |
|
|
|
import com.epmet.resi.group.dto.topic.result.ResiTopicIncludeIssueInfoResultDTO; |
|
|
|
import com.epmet.resi.group.dto.topic.result.ResiTopicInfoResultDTO; |
|
|
|
import com.epmet.resi.group.dto.topic.form.*; |
|
|
|
import com.epmet.resi.group.dto.topic.result.*; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.commons.logging.Log; |
|
|
|
import org.apache.commons.logging.LogFactory; |
|
|
@ -124,6 +122,12 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
@Autowired |
|
|
|
private ResiTopicDao resiTopicDao; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private GovOrgFeignClient govOrgFeignClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private GovIssueFeignClient govIssueFeignClient; |
|
|
|
|
|
|
|
private final Log logger = LogFactory.getLog(getClass()); |
|
|
|
|
|
|
|
@Override |
|
|
@ -495,7 +499,7 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
ResiTopicIncludeIssueDetailResultDTO resultDTO = |
|
|
|
ConvertUtils.sourceToTarget(topicDetail,ResiTopicIncludeIssueDetailResultDTO.class); |
|
|
|
resultDTO.setTopicId(topicId); |
|
|
|
resultDTO.setReleaseTime(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(topicDetail.getCreatedTime())); |
|
|
|
resultDTO.setReleaseTime(new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE).format(topicDetail.getCreatedTime())); |
|
|
|
resultDTO.setTopicContent(topicDetail.getTopicContent()); |
|
|
|
resultDTO.setReleaseAddress(topicDetail.getAddress()); |
|
|
|
resultDTO.setTopicStatus(topicDetail.getStatus()); |
|
|
@ -931,6 +935,132 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
topicInfo.setPublishedUser(issueInitiatorResult.getData().getIssueInitiator()); |
|
|
|
return topicInfo; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 首先需要查看当前用户是不是组长权限,然后检查该话题是否符合转议题标准 |
|
|
|
* @param topicIdFormDTO::getTopicId topicIdFormDTO::getUserId |
|
|
|
* @author wangc |
|
|
|
* @date 2020.05.12 13:56 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public ResiTopicShiftIssueInitResultDTO initTopicInfoWhenShift(CommonTopicIdFormDTO topicIdFormDTO) { |
|
|
|
//1.查看话题是否符合转议题
|
|
|
|
ResiTopicEntity topic = baseDao.selectById(topicIdFormDTO.getTopicId()); |
|
|
|
if(null == topic || StringUtils.isBlank(topic.getId())){ |
|
|
|
//没有相应的话题
|
|
|
|
logger.error(ModuleConstant.NO_SUCH_TOPIC); |
|
|
|
throw new RenException(ModuleConstant.NO_SUCH_TOPIC); |
|
|
|
}else if(topic.getShiftIssue() || StringUtils.isNotBlank(topic.getIssueId()) || StringUtils.equals(ModuleConstant.TOPIC_STATUS_DISCUSSING,topic.getStatus())){ |
|
|
|
logger.error(ModuleConstant.CURRENT_TOPIC_COULD_NOT_TURN_TO_ISSUE); |
|
|
|
throw new RenException(ModuleConstant.CURRENT_TOPIC_COULD_NOT_TURN_TO_ISSUE); |
|
|
|
} |
|
|
|
//2.通过话题找组信息,得到该组组长信息与当前用户进行
|
|
|
|
ResiGroupMemberInfoRedisDTO member = |
|
|
|
resiGroupMemberRedis.get(topic.getGroupId(),topicIdFormDTO.getUserId()); |
|
|
|
if(null == member || StringUtils.isBlank(member.getUserId()) ){ |
|
|
|
logger.error(ModuleConstant.GROUO_MEMBER_INFO_NOT_FOUND); |
|
|
|
throw new RenException(ModuleConstant.GROUO_MEMBER_INFO_NOT_FOUND); |
|
|
|
}else if(!StringUtils.equals(ModuleConstant.GROUP_LEADER,member.getGroupLeaderFlag())){ |
|
|
|
logger.error(ModuleConstant.NO_TEAMLEADER_AUTH); |
|
|
|
throw new RenException(ModuleConstant.NO_TEAMLEADER_AUTH); |
|
|
|
} |
|
|
|
//3.获取话题信息
|
|
|
|
Result<ResiTopicIncludeIssueDetailResultDTO> topicDetailResult = |
|
|
|
getTopicDetail(null,topicIdFormDTO.getTopicId()); |
|
|
|
if(topicDetailResult.success() && null != topicDetailResult.getData()){ |
|
|
|
ResiTopicShiftIssueInitResultDTO result = ConvertUtils.sourceToTarget(topicDetailResult.getData(),ResiTopicShiftIssueInitResultDTO.class); |
|
|
|
try { |
|
|
|
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE); |
|
|
|
|
|
|
|
result.setReleaseTime(format.parse(topicDetailResult.getData().getReleaseTime()).getTime()/NumConstant.ONE_THOUSAND); |
|
|
|
}catch (Exception e){ |
|
|
|
result.setReleaseTime(NumConstant.ZERO_L); |
|
|
|
logger.warn(String.format(ModuleConstant.DATE_FORMAT_PARSE_FAILURE,e.getMessage())); |
|
|
|
} |
|
|
|
ResiGroupInfoRedisDTO group = resiGroupRedis.get(topic.getGroupId()); |
|
|
|
if(null == group && StringUtils.isNotBlank(group.getGroupId())){ |
|
|
|
CustomerGridFormDTO gridForm = new CustomerGridFormDTO(); |
|
|
|
gridForm.setGridId(group.getGridId()); |
|
|
|
Result<CustomerGridDTO> gridInfoResult = govOrgFeignClient.getCustomerGridByGridId(gridForm); |
|
|
|
if(gridInfoResult.success() && null != gridInfoResult.getData() && StringUtils.isNotBlank(gridInfoResult.getData().getId())) { |
|
|
|
result.setBelongGridName(gridInfoResult.getData().getGridName()); |
|
|
|
} |
|
|
|
} |
|
|
|
logger.error(ModuleConstant.NO_SUCH_GROUP); |
|
|
|
result.setBelongGridName(ModuleConstant.EMPTY_STR); |
|
|
|
return result; |
|
|
|
} |
|
|
|
throw new RenException(ModuleConstant.FAILED_QUERY_TOPIC_INFO); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 话题转议题 1.统一时间 2.调用gov-org服务拿到数据权限的信息 3.调用gov-issue服务新增议题信息 |
|
|
|
* @param topicTurnIssueFromDTO |
|
|
|
* @author wangc |
|
|
|
* @date 2020.05.13 10:28 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void shiftIssue(ResiTopicTurnIssueFromDTO topicTurnIssueFromDTO) { |
|
|
|
//1.统一时间(群组服务 -> 议题服务)
|
|
|
|
Date now = new Date(); |
|
|
|
//2.调用gov-org获取数据权限
|
|
|
|
ResiTopicAndGroupResultDTO group = baseDao.getGroupInfoByTopicId(topicTurnIssueFromDTO.getTopicId()); |
|
|
|
if(null != group){ |
|
|
|
CommonGridIdFormDTO dataFilterParam = new CommonGridIdFormDTO(); |
|
|
|
dataFilterParam.setUserId(topicTurnIssueFromDTO.getUserId()); |
|
|
|
dataFilterParam.setGridId(group.getGridId()); |
|
|
|
Result<CommonDataFilterResultDTO> dataFilterResult = |
|
|
|
govOrgFeignClient.gridDataFilter(dataFilterParam); |
|
|
|
if(dataFilterResult.success() && null != dataFilterResult.getData()){ |
|
|
|
IssueShiftedFromTopicFormDTO issueInfo = ConvertUtils.sourceToTarget(topicTurnIssueFromDTO,IssueShiftedFromTopicFormDTO.class); |
|
|
|
issueInfo.setCreatedTime(now); |
|
|
|
issueInfo.setGridId(group.getGridId()); |
|
|
|
issueInfo.setCustomerId(group.getCustomerId()); |
|
|
|
issueInfo.setOrgId(dataFilterResult.getData().getAgencyId()); |
|
|
|
issueInfo.setOrgIdPath(dataFilterResult.getData().getOrgIdPath()); |
|
|
|
issueInfo.setOrgName(dataFilterResult.getData().getOrgName()); |
|
|
|
//3.获取小组名称、话题作者、议题发起人
|
|
|
|
ResiGroupMemberInfoRedisDTO topicAuthor = resiGroupMemberRedis.get(group.getGroupId(), group.getTopicAuthorId()); |
|
|
|
issueInfo.setTopicAuthor(null == topicAuthor ? ModuleConstant.EMPTY_STR : topicAuthor.getUserShowName()); |
|
|
|
ResiGroupMemberInfoRedisDTO issueAuthor = resiGroupMemberRedis.get(group.getGroupId(),topicTurnIssueFromDTO.getUserId()); |
|
|
|
issueInfo.setIssueAuthor(null == issueAuthor ? ModuleConstant.EMPTY_STR : issueAuthor.getUserShowName()); |
|
|
|
ResiGroupInfoRedisDTO groupCache = resiGroupRedis.get(group.getGroupId()); |
|
|
|
issueInfo.setGroupName(null == groupCache ? ModuleConstant.EMPTY_STR : groupCache.getGroupName()); |
|
|
|
issueInfo.setVotableCount(resiGroupMemberService.gridResiCount(group.getGridId())); |
|
|
|
//4.调用gov-issue新增议题
|
|
|
|
Result<String> issueResult = govIssueFeignClient.issueShiftedToTopic(issueInfo); |
|
|
|
//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); |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
logger.warn(ModuleConstant.FAILURE_TO_UPDATE_TOPIC); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
throw new RenException(ModuleConstant.FAILURE_TO_TURN_ISSUE); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|