|  |  | @ -37,12 +37,18 @@ import com.epmet.commons.tools.utils.ConvertUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.DateUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.Result; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.ScanContentUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.validator.ValidatorUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.constant.OrgInfoConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.CustomerGridDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.IssueApplicationDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.form.*; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.result.*; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.feign.EpmetUserOpenFeignClient; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.feign.GovOrgOpenFeignClient; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.result.CommonDataFilterResultDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.result.IssueInitiatorResultDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.result.UserResiInfoResultDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.feign.GovIssueOpenFeignClient; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.modules.constant.GroupMemberConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.modules.constant.ResiGroupRedisKeys; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.modules.feign.EpmetUserFeignClient; | 
			
		
	
	
		
			
				
					|  |  | @ -153,6 +159,9 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi | 
			
		
	
		
			
				
					|  |  |  |     @Autowired | 
			
		
	
		
			
				
					|  |  |  |     private EpmetUserOpenFeignClient userOpenFeignClient; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Autowired | 
			
		
	
		
			
				
					|  |  |  |     private GovIssueOpenFeignClient issueOpenFeignClient; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Value("${openapi.scan.server.url}") | 
			
		
	
		
			
				
					|  |  |  |     private String scanApiUrl; | 
			
		
	
		
			
				
					|  |  |  |     @Value("${openapi.scan.method.textSyncScan}") | 
			
		
	
	
		
			
				
					|  |  | @ -1276,7 +1285,22 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi | 
			
		
	
		
			
				
					|  |  |  |                 logger.error(ModuleConstant.NO_SUCH_GROUP); | 
			
		
	
		
			
				
					|  |  |  |                 result.setBelongGridName(ModuleConstant.EMPTY_STR); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |                 return result; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             //4.查询议题申请信息,因为审核中的议题在话题中无法体现是否被转为议题,所以需要查询一下当前话题是否已经提交申请
 | 
			
		
	
		
			
				
					|  |  |  |             Map<String,Object> param = new HashMap<>(); param.put(ModuleConstant.FILED_TOPIC_ID_HUMP,topicIdFormDTO.getTopicId()); | 
			
		
	
		
			
				
					|  |  |  |             Result<List<IssueApplicationDTO>> record = issueOpenFeignClient.list(param); | 
			
		
	
		
			
				
					|  |  |  |             if(!record.success()){ | 
			
		
	
		
			
				
					|  |  |  |                 log.error("com.epmet.modules.topic.service.impl.ResiTopicServiceImpl.initTopicInfoWhenShift,查询转议题提交记录失败,话题Id:{}",topicIdFormDTO.getTopicId()); | 
			
		
	
		
			
				
					|  |  |  |                 throw new RenException(ModuleConstant.FAILED_QUERY_ISSUE_APPLICATION_RECORD); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             if(!CollectionUtils.isEmpty(record.getData())){ | 
			
		
	
		
			
				
					|  |  |  |                 if(record.getData().size() > NumConstant.ONE){ | 
			
		
	
		
			
				
					|  |  |  |                     log.error("com.epmet.modules.topic.service.impl.ResiTopicServiceImpl.initTopicInfoWhenShift,查出多条转移提提交记录,话题Id:{}",topicIdFormDTO.getTopicId()); | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |                 result.setIssueApplicationId(record.getData().get(NumConstant.ZERO).getId()); | 
			
		
	
		
			
				
					|  |  |  |                 result.setApplyStatus(record.getData().get(NumConstant.ZERO).getApplyStatus()); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             return result; | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         throw new RenException(ModuleConstant.FAILED_QUERY_TOPIC_INFO); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
	
		
			
				
					|  |  | @ -1388,6 +1412,127 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * @Description 话题转议题 添加内容审核 | 
			
		
	
		
			
				
					|  |  |  |      * @param topicTurnIssueFromDTO | 
			
		
	
		
			
				
					|  |  |  |      * @return com.epmet.dto.result.FirstTopicShiftedToIssueApplicationResultDTO | 
			
		
	
		
			
				
					|  |  |  |      * @author wangc | 
			
		
	
		
			
				
					|  |  |  |      * @date 2020.11.20 10:26 | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public FirstTopicShiftedToIssueApplicationResultDTO shiftIssueV2(ResiTopicTurnIssueFromDTO topicTurnIssueFromDTO) { | 
			
		
	
		
			
				
					|  |  |  |         //话题转议题审核:标题、建议
 | 
			
		
	
		
			
				
					|  |  |  |         String issueTitle = topicTurnIssueFromDTO.getIssueTitle(); | 
			
		
	
		
			
				
					|  |  |  |         String suggestion = topicTurnIssueFromDTO.getSuggestion(); | 
			
		
	
		
			
				
					|  |  |  |         if (StringUtils.isNotBlank(issueTitle) || StringUtils.isNotBlank(suggestion)) { | 
			
		
	
		
			
				
					|  |  |  |             TextScanParamDTO textScan = new TextScanParamDTO(); | 
			
		
	
		
			
				
					|  |  |  |             //标题
 | 
			
		
	
		
			
				
					|  |  |  |             TextTaskDTO taskTitle = new TextTaskDTO(); | 
			
		
	
		
			
				
					|  |  |  |             taskTitle.setContent(issueTitle); | 
			
		
	
		
			
				
					|  |  |  |             taskTitle.setDataId(UUID.randomUUID().toString().replace("-", "")); | 
			
		
	
		
			
				
					|  |  |  |             textScan.getTasks().add(taskTitle); | 
			
		
	
		
			
				
					|  |  |  |             //建议
 | 
			
		
	
		
			
				
					|  |  |  |             TextTaskDTO taskSuggestion = new TextTaskDTO(); | 
			
		
	
		
			
				
					|  |  |  |             taskSuggestion.setDataId(UUID.randomUUID().toString().replace("-", "")); | 
			
		
	
		
			
				
					|  |  |  |             taskSuggestion.setContent(suggestion); | 
			
		
	
		
			
				
					|  |  |  |             textScan.getTasks().add(taskSuggestion); | 
			
		
	
		
			
				
					|  |  |  |             Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScan); | 
			
		
	
		
			
				
					|  |  |  |             if (!textSyncScanResult.success()) { | 
			
		
	
		
			
				
					|  |  |  |                 throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); | 
			
		
	
		
			
				
					|  |  |  |             } else { | 
			
		
	
		
			
				
					|  |  |  |                 if (!textSyncScanResult.getData().isAllPass()) { | 
			
		
	
		
			
				
					|  |  |  |                     log.error(String.format(TopicConstant.SHIFT_ISSUE, issueTitle, suggestion)); | 
			
		
	
		
			
				
					|  |  |  |                     throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         FirstTopicShiftedToIssueApplicationResultDTO result = null; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         //1.统一时间(群组服务 -> 议题服务)
 | 
			
		
	
		
			
				
					|  |  |  |         Date now = new Date(); | 
			
		
	
		
			
				
					|  |  |  |         //2.调用gov-org获取数据权限
 | 
			
		
	
		
			
				
					|  |  |  |         ResiTopicAndGroupResultDTO group = baseDao.getGroupInfoByTopicId(topicTurnIssueFromDTO.getTopicId()); | 
			
		
	
		
			
				
					|  |  |  |         if(null == group) { | 
			
		
	
		
			
				
					|  |  |  |             throw new RenException(ModuleConstant.FAILURE_TO_TURN_ISSUE); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         TopicInfoFormDTO topicId = new TopicInfoFormDTO(); | 
			
		
	
		
			
				
					|  |  |  |         topicId.setTopicId(topicTurnIssueFromDTO.getTopicId()); | 
			
		
	
		
			
				
					|  |  |  |         Integer issueCount = govIssueFeignClient.checkTopicShiftIssue(topicId).getData(); | 
			
		
	
		
			
				
					|  |  |  |         if (issueCount != NumConstant.ZERO){ | 
			
		
	
		
			
				
					|  |  |  |             throw new RenException(ModuleConstant.ALREADY_SHIFT_ISSUE); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         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())); | 
			
		
	
		
			
				
					|  |  |  |             issueInfo.setGroupId(group.getGroupId()); | 
			
		
	
		
			
				
					|  |  |  |             //4.调用gov-issue新增议题
 | 
			
		
	
		
			
				
					|  |  |  |             Result<FirstTopicShiftedToIssueApplicationResultDTO> issueResult = issueOpenFeignClient.topicShiftedToIssueV2(issueInfo); | 
			
		
	
		
			
				
					|  |  |  |             if (issueResult == null || !issueResult.success() || null == issueResult.getData()) { | 
			
		
	
		
			
				
					|  |  |  |                 throw new RenException(ModuleConstant.CREATE_ISSUE_ERROR); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             result = issueResult.getData(); | 
			
		
	
		
			
				
					|  |  |  |             ValidatorUtils.validateEntity(result, FirstTopicShiftedToIssueApplicationResultDTO.SwitchRequiredGroup.class); | 
			
		
	
		
			
				
					|  |  |  |             if(StringUtils.equals("close",result.getAuditSwitch())) { | 
			
		
	
		
			
				
					|  |  |  |                 ValidatorUtils.validateEntity(result, FirstTopicShiftedToIssueApplicationResultDTO.ForbidAuditionGroup.class); | 
			
		
	
		
			
				
					|  |  |  |                 //5.修改话题shiftIssue字段
 | 
			
		
	
		
			
				
					|  |  |  |                 ResiTopicEntity topic2Upd = new ResiTopicEntity(); | 
			
		
	
		
			
				
					|  |  |  |                 topic2Upd.setId(topicTurnIssueFromDTO.getTopicId()); | 
			
		
	
		
			
				
					|  |  |  |                 topic2Upd.setUpdatedBy(topicTurnIssueFromDTO.getUserId()); | 
			
		
	
		
			
				
					|  |  |  |                 topic2Upd.setShiftIssue(Boolean.TRUE); | 
			
		
	
		
			
				
					|  |  |  |                 topic2Upd.setIssueId(issueResult.getData().getIssueId()); | 
			
		
	
		
			
				
					|  |  |  |                 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); | 
			
		
	
		
			
				
					|  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |                 } else logger.warn(ModuleConstant.FAILURE_TO_UPDATE_TOPIC); | 
			
		
	
		
			
				
					|  |  |  |                 //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); | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             else { | 
			
		
	
		
			
				
					|  |  |  |                 ValidatorUtils.validateEntity(result, FirstTopicShiftedToIssueApplicationResultDTO.AllowAuditionGroup.class); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         }else throw new RenException(dataFilterResult.getMsg()); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         return result; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * @Description 政府端查看议题详情时的话题相关信息 | 
			
		
	
		
			
				
					|  |  |  |      * @param govTopicIssueInfoFormDTO | 
			
		
	
	
		
			
				
					|  |  | 
 |