|
|
@ -110,6 +110,12 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp |
|
|
|
private EpmetUserOpenFeignClient userOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private IssueCategoryService issueCategoryService; |
|
|
|
@Autowired |
|
|
|
private IssueTagsService issueTagsService; |
|
|
|
@Autowired |
|
|
|
private IssueProjectTagDictService issueProjectTagDictService; |
|
|
|
|
|
|
|
|
|
|
|
@Value("${openapi.scan.server.url}") |
|
|
@ -879,6 +885,120 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 议题管理-议题转项目-增加分类标签功能 |
|
|
|
* |
|
|
|
* @param formDTO |
|
|
|
* @return void |
|
|
|
* @author zhaoqifeng |
|
|
|
* @date 2020/12/9 10:01 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void shiftProjectV2(ShiftProjectFormDTO formDTO) { |
|
|
|
|
|
|
|
//获取议题分类
|
|
|
|
List<IssueCategoryDTO> categoryList = issueCategoryService.getCategoryByIssue(formDTO.getIssueId()); |
|
|
|
if (CollectionUtils.isEmpty(categoryList)) { |
|
|
|
throw new RenException(EpmetErrorCode.CATEGORY_IS_NULL.getCode()); |
|
|
|
} |
|
|
|
|
|
|
|
//公开回复内容审核
|
|
|
|
if (StringUtils.isNotBlank(formDTO.getPublicReply())) { |
|
|
|
TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); |
|
|
|
TextTaskDTO taskDTO = new TextTaskDTO(); |
|
|
|
taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); |
|
|
|
taskDTO.setContent(formDTO.getPublicReply()); |
|
|
|
textScanParamDTO.getTasks().add(taskDTO); |
|
|
|
Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); |
|
|
|
if (!textSyncScanResult.success()) { |
|
|
|
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); |
|
|
|
} else { |
|
|
|
if (!textSyncScanResult.getData().isAllPass()) { |
|
|
|
throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//因需要保证议题表中的转项目时间与创建项目时间一致 因此先新增项目数据再更新议题数据
|
|
|
|
//1:查询议题数据
|
|
|
|
IssueEntity entity = baseDao.selectById(formDTO.getIssueId()); |
|
|
|
if (null == entity) { |
|
|
|
throw new RenException(IssueConstant.SELECT_EXCEPTION); |
|
|
|
} |
|
|
|
if (IssueConstant.ISSUE_SHIFT_PROJECT.equals(entity.getIssueStatus())) { |
|
|
|
throw new RenException(IssueConstant.ISSUE_SHIFT_PROJECT_EXCEPTION); |
|
|
|
} |
|
|
|
if (!IssueConstant.ISSUE_VOTING.equals(entity.getIssueStatus())) { |
|
|
|
throw new RenException(IssueConstant.ISSUE_VOTING_EXCEPTION); |
|
|
|
} |
|
|
|
formDTO.setIssueDTO(ConvertUtils.sourceToTarget(entity, IssueDTO.class)); |
|
|
|
|
|
|
|
//2:调用resi-group查询话题创建人数据(目前议题来源只有来自话题),为了到项目服务初始数据以及发送消息使用
|
|
|
|
Result<ResiTopicDTO> resultTopicDTO = resiGroupFeignClient.getTopicById(entity.getSourceId()); |
|
|
|
if (!resultTopicDTO.success() || null == resultTopicDTO.getData()) { |
|
|
|
throw new RenException(IssueConstant.SELECT_TOPIC_EXCEPTION); |
|
|
|
} |
|
|
|
ResiTopicDTO topicDTO = resultTopicDTO.getData(); |
|
|
|
formDTO.setTopicDTO(topicDTO); |
|
|
|
|
|
|
|
//3:调用gov-project服务,新增项目各业务表初始数据
|
|
|
|
formDTO.setCategoryList(categoryList); |
|
|
|
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()); |
|
|
|
throw new RenException(IssueConstant.GOV_PRJECT_EXCEPTION); |
|
|
|
} |
|
|
|
IssueProjectResultDTO issueProjectResultDTO = resultDTO.getData(); |
|
|
|
//更新项目对标签的引用次数
|
|
|
|
if (CollectionUtils.isNotEmpty(tagList)) { |
|
|
|
tagList.forEach(item -> { |
|
|
|
IssueProjectTagDictDTO tag = issueProjectTagDictService.get(item.getTagId()); |
|
|
|
tag.setProjectUseCount(tag.getProjectUseCount() + NumConstant.ONE); |
|
|
|
issueProjectTagDictService.update(tag); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
//4:更新议题相关业务表数据
|
|
|
|
//4.1:更新议题表数据
|
|
|
|
entity.setIssueStatus(IssueConstant.ISSUE_SHIFT_PROJECT); |
|
|
|
entity.setShiftedTime(issueProjectResultDTO.getShiftedTime()); |
|
|
|
baseDao.updateById(entity); |
|
|
|
|
|
|
|
//4.2:议题处理进展表新增数据
|
|
|
|
IssueProcessEntity processEntity = new IssueProcessEntity(); |
|
|
|
processEntity.setIssueId(entity.getId()); |
|
|
|
processEntity.setIssueStatus(IssueConstant.ISSUE_SHIFT_PROJECT); |
|
|
|
processEntity.setOrgType(IssueConstant.ISSUE_GRID); |
|
|
|
processEntity.setOrgId(entity.getGridId()); |
|
|
|
processEntity.setOrgName(issueProjectResultDTO.getOrgName()); |
|
|
|
issueProcessDao.insert(processEntity); |
|
|
|
|
|
|
|
//4.3:议题项目关系表新增数据
|
|
|
|
IssueProjectRelationEntity relationEntity = new IssueProjectRelationEntity(); |
|
|
|
relationEntity.setIssueId(entity.getId()); |
|
|
|
relationEntity.setProjectId(issueProjectResultDTO.getProjectId()); |
|
|
|
issueProjectRelationDao.insert(relationEntity); |
|
|
|
|
|
|
|
//5:调用epmet-message服务,给居民端话题创建人、议题发起人以及政府端工作人员发送消息
|
|
|
|
if (!shiftProjectMessage(issueProjectResultDTO, formDTO, entity).success()) { |
|
|
|
throw new RenException(IssueConstant.SAVE_MSG_EXCEPTION); |
|
|
|
} |
|
|
|
//5-1:2020.10.26 添加给居民端话题创建人、议题发起人以及政府端工作人员推送微信订阅消息功能 sun
|
|
|
|
if (!wxmpShiftProjectMessage(issueProjectResultDTO, formDTO, entity).success()) { |
|
|
|
logger.error("议题转项目,推送微信订阅消息失败!"); |
|
|
|
} |
|
|
|
|
|
|
|
//6:缓存中网格下表决中的议题总数减1
|
|
|
|
govIssueRedis.subtractWorkGrassrootsIssueRedDotValue(entity.getGridId()); |
|
|
|
try{ |
|
|
|
issueVoteStatisticalService.syncVotingCacheToDbByParams(formDTO.getIssueId(),entity.getGridId(),null); |
|
|
|
}catch(RenException e){ |
|
|
|
logger.error(e.getInternalMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 议题转项目时给话题创建人、议题发起人、勾选的工作人员分别推送消息 |
|
|
|
* @author sun |
|
|
|