|  |  | @ -17,24 +17,26 @@ | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | package com.epmet.modules.topic.service.impl; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | import com.alibaba.fastjson.JSON; | 
			
		
	
		
			
				
					|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
			
		
	
		
			
				
					|  |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.constant.FieldConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.constant.MqConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.constant.NumConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.enums.EventEnum; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.exception.EpmetErrorCode; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.exception.RenException; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.page.PageData; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.scan.param.ImgScanParamDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.scan.param.ImgTaskDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.scan.param.TextScanParamDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.scan.param.TextTaskDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.scan.param.*; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.scan.result.AsyncScanResult; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.scan.result.AsyncScanTaskDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.scan.result.SyncScanResult; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.scan.result.VoiceResultDTO; | 
			
		
	
		
			
				
					|  |  |  | 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.commons.tools.utils.ScanContentUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.*; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.result.AllGridsByUserIdResultDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.feign.GovOrgOpenFeignClient; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.modules.feign.EpmetUserFeignClient; | 
			
		
	
	
		
			
				
					|  |  | @ -53,6 +55,7 @@ import com.epmet.modules.topic.dao.TopicDraftDao; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.modules.topic.entity.*; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.modules.topic.service.TopicDraftAttachmentService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.modules.topic.service.TopicDraftOperationService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.modules.topic.service.TopicDraftScanTaskService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.modules.topic.service.TopicDraftService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.modules.utils.ModuleConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.resi.group.constant.MemberStateConstant; | 
			
		
	
	
		
			
				
					|  |  | @ -61,10 +64,10 @@ import com.epmet.resi.group.dto.group.ResiGroupInfoRedisDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.resi.group.dto.group.ResiGroupStatisticalInfoRedisDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.resi.group.dto.member.ResiGroupMemberInfoRedisDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.resi.group.dto.topic.ResiTopicDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.resi.group.dto.topic.TopicDraftAttachmentDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.resi.group.dto.topic.TopicDraftDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.resi.group.dto.topic.TopicDraftOperationDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.resi.group.dto.topic.TopicDraftScanTaskDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.resi.group.dto.topic.form.*; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.resi.group.dto.topic.result.DraftDetailResultDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.resi.group.dto.topic.result.MyAuditingListResultDTO; | 
			
		
	
	
		
			
				
					|  |  | @ -96,6 +99,12 @@ import java.util.stream.Collectors; | 
			
		
	
		
			
				
					|  |  |  | public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicDraftEntity> implements TopicDraftService { | 
			
		
	
		
			
				
					|  |  |  |     private static Logger logger = LoggerFactory.getLogger(TopicDraftServiceImpl.class); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     private ThreadFactory namedThreadFactory = new ThreadFactoryBuilder() | 
			
		
	
		
			
				
					|  |  |  |             .setNameFormat("TopicDraftService-pool-%d").build(); | 
			
		
	
		
			
				
					|  |  |  |     private ExecutorService threadPool = new ThreadPoolExecutor(1, 1, | 
			
		
	
		
			
				
					|  |  |  |             1L, TimeUnit.MINUTES, | 
			
		
	
		
			
				
					|  |  |  |             new LinkedBlockingQueue<>(500), namedThreadFactory, new ThreadPoolExecutor.CallerRunsPolicy()); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Autowired | 
			
		
	
		
			
				
					|  |  |  |     private GovOrgOpenFeignClient govOrgOpenFeignClient; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | @ -132,6 +141,8 @@ public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicD | 
			
		
	
		
			
				
					|  |  |  |     private TopicDraftOperationService topicDraftOperationService; | 
			
		
	
		
			
				
					|  |  |  |     @Autowired | 
			
		
	
		
			
				
					|  |  |  |     private ResiGroupMemberRedis resiGroupMemberRedis; | 
			
		
	
		
			
				
					|  |  |  |     @Autowired | 
			
		
	
		
			
				
					|  |  |  |     private TopicDraftScanTaskService topicDraftScanTaskService; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Value("${openapi.scan.server.url}") | 
			
		
	
		
			
				
					|  |  |  |     private String scanApiUrl; | 
			
		
	
	
		
			
				
					|  |  | @ -139,6 +150,10 @@ public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicD | 
			
		
	
		
			
				
					|  |  |  |     private String textSyncScanMethod; | 
			
		
	
		
			
				
					|  |  |  |     @Value("${openapi.scan.method.imgSyncScan}") | 
			
		
	
		
			
				
					|  |  |  |     private String imgSyncScanMethod; | 
			
		
	
		
			
				
					|  |  |  |     @Value("${openapi.scan.method.voiceAsyncScan}") | 
			
		
	
		
			
				
					|  |  |  |     private String voiceAsyncScanMethod; | 
			
		
	
		
			
				
					|  |  |  |     @Value("${openapi.scan.method.voiceResults}") | 
			
		
	
		
			
				
					|  |  |  |     private String voiceResultsMethod; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public PageData<TopicDraftDTO> page(Map<String, Object> params) { | 
			
		
	
	
		
			
				
					|  |  | @ -234,6 +249,7 @@ public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicD | 
			
		
	
		
			
				
					|  |  |  |      * @date 2020/12/17 15:49 | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     @Transactional(rollbackFor = Exception.class) | 
			
		
	
		
			
				
					|  |  |  |     public void createTopic(TokenDto tokenDto, CreateTopicFormDTO formDTO) { | 
			
		
	
		
			
				
					|  |  |  |         if(StringUtils.isEmpty(formDTO.getTopicContent()) && CollectionUtils.isEmpty(formDTO.getVideoList())) { | 
			
		
	
		
			
				
					|  |  |  |             //话题内容和语音不能同时为空
 | 
			
		
	
	
		
			
				
					|  |  | @ -259,32 +275,42 @@ public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicD | 
			
		
	
		
			
				
					|  |  |  |             old.setIsSee(NumConstant.ONE_STR); | 
			
		
	
		
			
				
					|  |  |  |             baseDao.updateById(old); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         List<ImgTaskDTO> imageDTOList = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |         if(CollectionUtils.isNotEmpty(formDTO.getImageList())){ | 
			
		
	
		
			
				
					|  |  |  |             TopicDraftAttachmentDTO attachment = new TopicDraftAttachmentDTO(); | 
			
		
	
		
			
				
					|  |  |  |             int sort = 0; | 
			
		
	
		
			
				
					|  |  |  |             for(String url : formDTO.getImageList()){ | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setAttachmentUrl(url); | 
			
		
	
		
			
				
					|  |  |  |             for(FileDTO file : formDTO.getImageList()){ | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setAttachmentUrl(file.getUrl()); | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setTopicDraftId(topic.getId()); | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setCreatedBy(tokenDto.getUserId()); | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setAttachmentFormat(url.substring(url.lastIndexOf(".") + NumConstant.ONE).toLowerCase()); | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setAttachmentFormat(file.getUrl().substring(file.getUrl().lastIndexOf(".") + NumConstant.ONE).toLowerCase()); | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setSort(sort++); | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setAttachmentType("image"); | 
			
		
	
		
			
				
					|  |  |  |                 topicDraftAttachmentService.save(attachment); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |                 ImgTaskDTO task = new ImgTaskDTO(); | 
			
		
	
		
			
				
					|  |  |  |                 task.setDataId(attachment.getId()); | 
			
		
	
		
			
				
					|  |  |  |                 task.setUrl(file.getUrl()); | 
			
		
	
		
			
				
					|  |  |  |                 imageDTOList.add(task); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         List<VoiceTaskDTO> voiceDTOList = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |         if(CollectionUtils.isNotEmpty(formDTO.getVideoList())){ | 
			
		
	
		
			
				
					|  |  |  |             TopicDraftAttachmentDTO attachment = new TopicDraftAttachmentDTO(); | 
			
		
	
		
			
				
					|  |  |  |             int sort = 0; | 
			
		
	
		
			
				
					|  |  |  |             for(String url : formDTO.getVideoList()){ | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setAttachmentUrl(url); | 
			
		
	
		
			
				
					|  |  |  |             for(FileDTO file : formDTO.getVideoList()){ | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setAttachmentUrl(file.getUrl()); | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setTopicDraftId(topic.getId()); | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setCreatedBy(tokenDto.getUserId()); | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setAttachmentFormat(url.substring(url.lastIndexOf(".") + NumConstant.ONE).toLowerCase()); | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setAttachmentFormat(file.getUrl().substring(file.getUrl().lastIndexOf(".") + NumConstant.ONE).toLowerCase()); | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setSort(sort++); | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setAttachmentType("image"); | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setAttachmentType("voice"); | 
			
		
	
		
			
				
					|  |  |  |                 topicDraftAttachmentService.save(attachment); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |                 VoiceTaskDTO task = new VoiceTaskDTO(); | 
			
		
	
		
			
				
					|  |  |  |                 task.setDataId(attachment.getId()); | 
			
		
	
		
			
				
					|  |  |  |                 task.setUrl(file.getUrl()); | 
			
		
	
		
			
				
					|  |  |  |                 voiceDTOList.add(task); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | @ -313,7 +339,7 @@ public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicD | 
			
		
	
		
			
				
					|  |  |  |                     TopicDraftEntity draftEntity = new TopicDraftEntity(); | 
			
		
	
		
			
				
					|  |  |  |                     draftEntity.setId(topic.getId()); | 
			
		
	
		
			
				
					|  |  |  |                     draftEntity.setDraftStatus(TopicConstant.BLOCK); | 
			
		
	
		
			
				
					|  |  |  |                     draftEntity.setDraftReason("内容审核失败"); | 
			
		
	
		
			
				
					|  |  |  |                     draftEntity.setDraftReason("话题存在违规内容"); | 
			
		
	
		
			
				
					|  |  |  |                     baseDao.updateById(draftEntity); | 
			
		
	
		
			
				
					|  |  |  |                     //话题操作记录
 | 
			
		
	
		
			
				
					|  |  |  |                     TopicDraftOperationDTO operationDTO = new TopicDraftOperationDTO(); | 
			
		
	
	
		
			
				
					|  |  | @ -328,14 +354,9 @@ public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicD | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         //创建话题图片审核
 | 
			
		
	
		
			
				
					|  |  |  |         if (CollectionUtils.isNotEmpty(formDTO.getImageList())){ | 
			
		
	
		
			
				
					|  |  |  |         if (CollectionUtils.isNotEmpty(imageDTOList)){ | 
			
		
	
		
			
				
					|  |  |  |             ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO(); | 
			
		
	
		
			
				
					|  |  |  |             formDTO.getImageList().forEach(url -> { | 
			
		
	
		
			
				
					|  |  |  |                 ImgTaskDTO task = new ImgTaskDTO(); | 
			
		
	
		
			
				
					|  |  |  |                 task.setDataId(UUID.randomUUID().toString().replace("-", "")); | 
			
		
	
		
			
				
					|  |  |  |                 task.setUrl(url); | 
			
		
	
		
			
				
					|  |  |  |                 imgScanParamDTO.getTasks().add(task); | 
			
		
	
		
			
				
					|  |  |  |             }); | 
			
		
	
		
			
				
					|  |  |  |             imgScanParamDTO.setTasks(imageDTOList); | 
			
		
	
		
			
				
					|  |  |  |             Result<SyncScanResult> imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO); | 
			
		
	
		
			
				
					|  |  |  |             if (!imgScanResult.success()){ | 
			
		
	
		
			
				
					|  |  |  |                 throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); | 
			
		
	
	
		
			
				
					|  |  | @ -345,7 +366,7 @@ public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicD | 
			
		
	
		
			
				
					|  |  |  |                     TopicDraftEntity draftEntity = new TopicDraftEntity(); | 
			
		
	
		
			
				
					|  |  |  |                     draftEntity.setId(topic.getId()); | 
			
		
	
		
			
				
					|  |  |  |                     draftEntity.setDraftStatus(TopicConstant.BLOCK); | 
			
		
	
		
			
				
					|  |  |  |                     draftEntity.setDraftReason("图片审核失败"); | 
			
		
	
		
			
				
					|  |  |  |                     draftEntity.setDraftReason("图片存在违规内容"); | 
			
		
	
		
			
				
					|  |  |  |                     baseDao.updateById(draftEntity); | 
			
		
	
		
			
				
					|  |  |  |                     //话题操作记录
 | 
			
		
	
		
			
				
					|  |  |  |                     TopicDraftOperationDTO operationDTO = new TopicDraftOperationDTO(); | 
			
		
	
	
		
			
				
					|  |  | @ -355,21 +376,116 @@ public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicD | 
			
		
	
		
			
				
					|  |  |  |                     topicDraftOperationService.save(operationDTO); | 
			
		
	
		
			
				
					|  |  |  |                     throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode()); | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |                 if(CollectionUtils.isNotEmpty(imgScanResult.getData().getSuccessDataIds())) { | 
			
		
	
		
			
				
					|  |  |  |                     imgScanResult.getData().getSuccessDataIds().forEach(item -> { | 
			
		
	
		
			
				
					|  |  |  |                         TopicDraftAttachmentDTO dto = new TopicDraftAttachmentDTO(); | 
			
		
	
		
			
				
					|  |  |  |                         dto.setId(item); | 
			
		
	
		
			
				
					|  |  |  |                         dto.setStatus(TopicConstant.AUTO_PASSED); | 
			
		
	
		
			
				
					|  |  |  |                         topicDraftAttachmentService.update(dto); | 
			
		
	
		
			
				
					|  |  |  |                     }); | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |                 if(CollectionUtils.isNotEmpty(imgScanResult.getData().getFailDataIds())) { | 
			
		
	
		
			
				
					|  |  |  |                     imgScanResult.getData().getFailDataIds().forEach(item -> { | 
			
		
	
		
			
				
					|  |  |  |                         TopicDraftAttachmentDTO dto = new TopicDraftAttachmentDTO(); | 
			
		
	
		
			
				
					|  |  |  |                         dto.setId(item); | 
			
		
	
		
			
				
					|  |  |  |                         dto.setStatus(TopicConstant.BLOCK); | 
			
		
	
		
			
				
					|  |  |  |                         dto.setReason("图片存在违规内容"); | 
			
		
	
		
			
				
					|  |  |  |                         topicDraftAttachmentService.update(dto); | 
			
		
	
		
			
				
					|  |  |  |                     }); | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         //TODO 创建话题语音审核
 | 
			
		
	
		
			
				
					|  |  |  |         if (CollectionUtils.isNotEmpty(formDTO.getVideoList())){ | 
			
		
	
		
			
				
					|  |  |  |             ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO(); | 
			
		
	
		
			
				
					|  |  |  |             formDTO.getVideoList().forEach(url -> { | 
			
		
	
		
			
				
					|  |  |  |                 ImgTaskDTO task = new ImgTaskDTO(); | 
			
		
	
		
			
				
					|  |  |  |                 task.setDataId(UUID.randomUUID().toString().replace("-", "")); | 
			
		
	
		
			
				
					|  |  |  |                 task.setUrl(url); | 
			
		
	
		
			
				
					|  |  |  |                 imgScanParamDTO.getTasks().add(task); | 
			
		
	
		
			
				
					|  |  |  |                 //TODO 根据返回值,
 | 
			
		
	
		
			
				
					|  |  |  |             }); | 
			
		
	
		
			
				
					|  |  |  |         //创建话题语音审核
 | 
			
		
	
		
			
				
					|  |  |  |         if (CollectionUtils.isNotEmpty(voiceDTOList)){ | 
			
		
	
		
			
				
					|  |  |  |             VoiceScanParamDTO voiceScanParamDTO = new VoiceScanParamDTO(); | 
			
		
	
		
			
				
					|  |  |  |             voiceScanParamDTO.setTasks(voiceDTOList); | 
			
		
	
		
			
				
					|  |  |  |             voiceScanParamDTO.setOpenCallBack(false); | 
			
		
	
		
			
				
					|  |  |  |             Result<AsyncScanResult> voiceScanResult = ScanContentUtils.voiceAsyncScan(scanApiUrl.concat(voiceAsyncScanMethod), voiceScanParamDTO); | 
			
		
	
		
			
				
					|  |  |  |             if (!voiceScanResult.success() || !voiceScanResult.getData().isAllSuccess()){ | 
			
		
	
		
			
				
					|  |  |  |                 throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); | 
			
		
	
		
			
				
					|  |  |  |             } else { | 
			
		
	
		
			
				
					|  |  |  |                 List<AsyncScanTaskDTO> taskList = voiceScanResult.getData().getSuccessTasks(); | 
			
		
	
		
			
				
					|  |  |  |                 List<String> taskIds = taskList.stream().map(AsyncScanTaskDTO :: getTaskId).collect(Collectors.toList()); | 
			
		
	
		
			
				
					|  |  |  |                 //提交记录存入task表
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |                 List<TopicDraftScanTaskEntity> scanTaskEntityList = taskList.stream().map(item -> { | 
			
		
	
		
			
				
					|  |  |  |                     TopicDraftScanTaskEntity taskEntity = new TopicDraftScanTaskEntity(); | 
			
		
	
		
			
				
					|  |  |  |                     taskEntity.setCustomerId(formDTO.getCustomerId()); | 
			
		
	
		
			
				
					|  |  |  |                     taskEntity.setTopicDraftId(topic.getId()); | 
			
		
	
		
			
				
					|  |  |  |                     taskEntity.setTopicDraftAttachmentId(item.getDataId()); | 
			
		
	
		
			
				
					|  |  |  |                     taskEntity.setTaskId(item.getTaskId()); | 
			
		
	
		
			
				
					|  |  |  |                     taskEntity.setStatus(TopicConstant.AUDITING); | 
			
		
	
		
			
				
					|  |  |  |                     taskEntity.setAttachmentType(TopicConstant.VOICE); | 
			
		
	
		
			
				
					|  |  |  |                     return taskEntity; | 
			
		
	
		
			
				
					|  |  |  |                 }).collect(Collectors.toList()); | 
			
		
	
		
			
				
					|  |  |  |                 topicDraftScanTaskService.insertBatch(scanTaskEntityList); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |                 //轮询
 | 
			
		
	
		
			
				
					|  |  |  |                 threadPool.submit(() -> { | 
			
		
	
		
			
				
					|  |  |  |                     while (true) { | 
			
		
	
		
			
				
					|  |  |  |                         Result<List<VoiceResultDTO>> voiceResults = ScanContentUtils.voiceResults(scanApiUrl.concat(voiceResultsMethod), taskIds); | 
			
		
	
		
			
				
					|  |  |  |                         if (voiceResults.success()) { | 
			
		
	
		
			
				
					|  |  |  |                             boolean isAllPass = true; | 
			
		
	
		
			
				
					|  |  |  |                             List<VoiceResultDTO> list = voiceResults.getData(); | 
			
		
	
		
			
				
					|  |  |  |                             for (VoiceResultDTO item : list) { | 
			
		
	
		
			
				
					|  |  |  |                                 if (TopicConstant.REVIEW.equals(item.getSuggestion())) { | 
			
		
	
		
			
				
					|  |  |  |                                     //结果不确定
 | 
			
		
	
		
			
				
					|  |  |  |                                     TopicDraftAttachmentDTO dto = new TopicDraftAttachmentDTO(); | 
			
		
	
		
			
				
					|  |  |  |                                     dto.setId(item.getDataId()); | 
			
		
	
		
			
				
					|  |  |  |                                     dto.setStatus(TopicConstant.REVIEW); | 
			
		
	
		
			
				
					|  |  |  |                                     dto.setReason(item.getLabelDesc()); | 
			
		
	
		
			
				
					|  |  |  |                                     topicDraftAttachmentService.update(dto); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |                                     TopicDraftScanTaskDTO taskDTO = new TopicDraftScanTaskDTO(); | 
			
		
	
		
			
				
					|  |  |  |                                     taskDTO.setTaskId(item.getTaskId()); | 
			
		
	
		
			
				
					|  |  |  |                                     taskDTO.setStatus(TopicConstant.REVIEW); | 
			
		
	
		
			
				
					|  |  |  |                                     topicDraftScanTaskService.updateByTask(taskDTO); | 
			
		
	
		
			
				
					|  |  |  |                                     isAllPass = false; | 
			
		
	
		
			
				
					|  |  |  |                                 } else if (TopicConstant.BLOCK.equals(item.getSuggestion())) { | 
			
		
	
		
			
				
					|  |  |  |                                     //结果违规
 | 
			
		
	
		
			
				
					|  |  |  |                                     TopicDraftAttachmentDTO dto = new TopicDraftAttachmentDTO(); | 
			
		
	
		
			
				
					|  |  |  |                                     dto.setId(item.getDataId()); | 
			
		
	
		
			
				
					|  |  |  |                                     dto.setStatus(TopicConstant.BLOCK); | 
			
		
	
		
			
				
					|  |  |  |                                     dto.setReason(item.getLabelDesc()); | 
			
		
	
		
			
				
					|  |  |  |                                     topicDraftAttachmentService.update(dto); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |                                     TopicDraftScanTaskDTO taskDTO = new TopicDraftScanTaskDTO(); | 
			
		
	
		
			
				
					|  |  |  |                                     taskDTO.setTaskId(item.getTaskId()); | 
			
		
	
		
			
				
					|  |  |  |                                     taskDTO.setStatus(TopicConstant.BLOCK); | 
			
		
	
		
			
				
					|  |  |  |                                     topicDraftScanTaskService.updateByTask(taskDTO); | 
			
		
	
		
			
				
					|  |  |  |                                     isAllPass = false; | 
			
		
	
		
			
				
					|  |  |  |                                 } else { | 
			
		
	
		
			
				
					|  |  |  |                                     //审核通过
 | 
			
		
	
		
			
				
					|  |  |  |                                     TopicDraftAttachmentDTO dto = new TopicDraftAttachmentDTO(); | 
			
		
	
		
			
				
					|  |  |  |                                     dto.setId(item.getDataId()); | 
			
		
	
		
			
				
					|  |  |  |                                     dto.setStatus(TopicConstant.AUTO_PASSED); | 
			
		
	
		
			
				
					|  |  |  |                                     dto.setReason(item.getLabelDesc()); | 
			
		
	
		
			
				
					|  |  |  |                                     topicDraftAttachmentService.update(dto); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |                                     TopicDraftScanTaskDTO taskDTO = new TopicDraftScanTaskDTO(); | 
			
		
	
		
			
				
					|  |  |  |                                     taskDTO.setTaskId(item.getTaskId()); | 
			
		
	
		
			
				
					|  |  |  |                                     taskDTO.setStatus(TopicConstant.AUTO_PASSED); | 
			
		
	
		
			
				
					|  |  |  |                                     topicDraftScanTaskService.updateByTask(taskDTO); | 
			
		
	
		
			
				
					|  |  |  |                                 } | 
			
		
	
		
			
				
					|  |  |  |                                 //审核通过,发布话题
 | 
			
		
	
		
			
				
					|  |  |  |                                 if(isAllPass) { | 
			
		
	
		
			
				
					|  |  |  |                                     saveTopic(tokenDto, formDTO, topic.getId()); | 
			
		
	
		
			
				
					|  |  |  |                                 } | 
			
		
	
		
			
				
					|  |  |  |                             } | 
			
		
	
		
			
				
					|  |  |  |                             break; | 
			
		
	
		
			
				
					|  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |                         try { | 
			
		
	
		
			
				
					|  |  |  |                             Thread.sleep(600000); | 
			
		
	
		
			
				
					|  |  |  |                         } catch (InterruptedException e) { | 
			
		
	
		
			
				
					|  |  |  |                             e.printStackTrace(); | 
			
		
	
		
			
				
					|  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |                 }); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |         } else { | 
			
		
	
		
			
				
					|  |  |  |             //TODO 话题草稿状态为 auto_passed: 自动通过
 | 
			
		
	
		
			
				
					|  |  |  |             //话题草稿状态为 auto_passed: 自动通过
 | 
			
		
	
		
			
				
					|  |  |  |             //更新话题状态block
 | 
			
		
	
		
			
				
					|  |  |  |             TopicDraftEntity draftEntity = new TopicDraftEntity(); | 
			
		
	
		
			
				
					|  |  |  |             draftEntity.setId(topic.getId()); | 
			
		
	
	
		
			
				
					|  |  | @ -512,6 +628,8 @@ public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicD | 
			
		
	
		
			
				
					|  |  |  |                 voiceList.forEach(item -> item.setStatus(TopicConstant.APPROVED)); | 
			
		
	
		
			
				
					|  |  |  |                 topicDraftAttachmentService.updateBatchById(ConvertUtils.sourceToTarget(voiceList, TopicDraftAttachmentEntity.class)); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             //发送积分
 | 
			
		
	
		
			
				
					|  |  |  |             sendMqMsg(draft.getCreatedBy(), draft.getCustomerId()); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         //记录操作记录
 | 
			
		
	
		
			
				
					|  |  |  |         TopicDraftOperationDTO operationDTO = new TopicDraftOperationDTO(); | 
			
		
	
	
		
			
				
					|  |  | @ -553,17 +671,31 @@ public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicD | 
			
		
	
		
			
				
					|  |  |  |         if(CollectionUtils.isNotEmpty(formDTO.getImageList())){ | 
			
		
	
		
			
				
					|  |  |  |             ResiTopicAttachmentEntity attachment = new ResiTopicAttachmentEntity(); | 
			
		
	
		
			
				
					|  |  |  |             int sort = 0; | 
			
		
	
		
			
				
					|  |  |  |             for(String url : formDTO.getImageList()){ | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setAttachmentUrl(url); | 
			
		
	
		
			
				
					|  |  |  |             for(FileDTO file : formDTO.getImageList()){ | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setAttachmentUrl(file.getUrl()); | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setTopicId(topic.getId()); | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setCreatedBy(tokenDto.getUserId()); | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setAttachmentFormat(url.substring(url.lastIndexOf(".") + NumConstant.ONE).toLowerCase()); | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setAttachmentFormat(file.getUrl().substring(file.getUrl().lastIndexOf(".") + NumConstant.ONE).toLowerCase()); | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setSort(sort++); | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setAttachmentType("image"); | 
			
		
	
		
			
				
					|  |  |  |                 resiTopicAttachmentDao.insertOne(attachment); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         if(CollectionUtils.isNotEmpty(formDTO.getVoiceList())){ | 
			
		
	
		
			
				
					|  |  |  |             ResiTopicAttachmentEntity attachment = new ResiTopicAttachmentEntity(); | 
			
		
	
		
			
				
					|  |  |  |             int sort = 0; | 
			
		
	
		
			
				
					|  |  |  |             for(FileDTO file : formDTO.getVoiceList()){ | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setAttachmentUrl(file.getUrl()); | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setTopicId(topic.getId()); | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setCreatedBy(tokenDto.getUserId()); | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setAttachmentFormat(file.getUrl().substring(file.getUrl().lastIndexOf(".") + NumConstant.ONE).toLowerCase()); | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setSort(sort++); | 
			
		
	
		
			
				
					|  |  |  |                 attachment.setAttachmentType("voice"); | 
			
		
	
		
			
				
					|  |  |  |                 resiTopicAttachmentDao.insertOne(attachment); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         //3.话题操作记录
 | 
			
		
	
		
			
				
					|  |  |  |         ResiTopicOperationEntity operation = new ResiTopicOperationEntity(); | 
			
		
	
		
			
				
					|  |  |  |         operation.setTopicId(topic.getId()); | 
			
		
	
	
		
			
				
					|  |  | @ -605,6 +737,30 @@ public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicD | 
			
		
	
		
			
				
					|  |  |  |         draftEntity.setId(draftId); | 
			
		
	
		
			
				
					|  |  |  |         draftEntity.setTopicId(topic.getId()); | 
			
		
	
		
			
				
					|  |  |  |         baseDao.updateById(draftEntity); | 
			
		
	
		
			
				
					|  |  |  |         sendMqMsg(tokenDto.getUserId(), formDTO.getCustomerId()); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     private void sendMqMsg(String userId, String customerId) { | 
			
		
	
		
			
				
					|  |  |  |         //6.发送积分
 | 
			
		
	
		
			
				
					|  |  |  |         MqBaseMsgDTO mqBaseMsgDTO=new MqBaseMsgDTO(); | 
			
		
	
		
			
				
					|  |  |  |         //mq的事件类型
 | 
			
		
	
		
			
				
					|  |  |  |         mqBaseMsgDTO.setEventClass(EventEnum.PUBLISH_ONE_TOPIC.getEventClass()); | 
			
		
	
		
			
				
					|  |  |  |         //事件code
 | 
			
		
	
		
			
				
					|  |  |  |         mqBaseMsgDTO.setEventTag(EventEnum.PUBLISH_ONE_TOPIC.getEventTag()); | 
			
		
	
		
			
				
					|  |  |  |         List<BasePointEventMsg> actPointEventMsgList=new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |         BasePointEventMsg actPointEventMsg=new BasePointEventMsg(); | 
			
		
	
		
			
				
					|  |  |  |         actPointEventMsg.setCustomerId(customerId); | 
			
		
	
		
			
				
					|  |  |  |         actPointEventMsg.setUserId(userId); | 
			
		
	
		
			
				
					|  |  |  |         actPointEventMsg.setActionFlag(MqConstant.PLUS); | 
			
		
	
		
			
				
					|  |  |  |         actPointEventMsg.setIsCommon(false); | 
			
		
	
		
			
				
					|  |  |  |         actPointEventMsgList.add(actPointEventMsg); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         mqBaseMsgDTO.setMsg(JSON.toJSONString(actPointEventMsgList)); | 
			
		
	
		
			
				
					|  |  |  |         Result mqResult = SendMqMsgUtils.sendMsg(mqBaseMsgDTO); | 
			
		
	
		
			
				
					|  |  |  |         if(!mqResult.success()){ | 
			
		
	
		
			
				
					|  |  |  |             logger.error("发表话题积分添加失败"); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | 
 |