|
|
@ -50,10 +50,7 @@ import com.epmet.modules.topic.dao.ResiTopicAttachmentDao; |
|
|
|
import com.epmet.modules.topic.dao.ResiTopicDao; |
|
|
|
import com.epmet.modules.topic.dao.ResiTopicOperationDao; |
|
|
|
import com.epmet.modules.topic.dao.TopicDraftDao; |
|
|
|
import com.epmet.modules.topic.entity.ResiTopicAttachmentEntity; |
|
|
|
import com.epmet.modules.topic.entity.ResiTopicEntity; |
|
|
|
import com.epmet.modules.topic.entity.ResiTopicOperationEntity; |
|
|
|
import com.epmet.modules.topic.entity.TopicDraftEntity; |
|
|
|
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.TopicDraftService; |
|
|
@ -64,6 +61,7 @@ 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; |
|
|
@ -437,12 +435,18 @@ public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicD |
|
|
|
result.setReleaseTime(new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE).format(entity.getCreatedTime())); |
|
|
|
result.setTopicContent(entity.getTopicContent()); |
|
|
|
result.setReleaseAddress(entity.getAddress()); |
|
|
|
if (TopicConstant.AUDITING.equals(entity.getDraftStatus()) || TopicConstant.REVIEW.equals(entity.getDraftStatus())) { |
|
|
|
result.setStatus(TopicConstant.AUDITING); |
|
|
|
} else if (TopicConstant.BLOCK.equals(entity.getDraftStatus()) || TopicConstant.REJECTED.equals(entity.getDraftStatus())) { |
|
|
|
result.setStatus(TopicConstant.REJECTED); |
|
|
|
} |
|
|
|
//2.查询话题图片附件
|
|
|
|
List<String> imageUrls = topicDraftAttachmentService.getFileList(formDTO.getTopicDraftId(), TopicConstant.IMAGE); |
|
|
|
List<String> imageUrls = |
|
|
|
topicDraftAttachmentService.getFileList(formDTO.getTopicDraftId(), TopicConstant.IMAGE).stream().map(TopicDraftAttachmentDTO::getAttachmentUrl).collect(Collectors.toList()); |
|
|
|
result.setImageList(imageUrls); |
|
|
|
|
|
|
|
//3.查询话题音频附件
|
|
|
|
List<String> voiceUrls = topicDraftAttachmentService.getFileList(formDTO.getTopicDraftId(), TopicConstant.VOICE); |
|
|
|
List<String> voiceUrls = topicDraftAttachmentService.getFileList(formDTO.getTopicDraftId(), TopicConstant.VOICE).stream().map(TopicDraftAttachmentDTO::getAttachmentUrl).collect(Collectors.toList()); |
|
|
|
result.setVoiceList(voiceUrls); |
|
|
|
|
|
|
|
//3.拿取用户信息
|
|
|
@ -481,8 +485,40 @@ public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicD |
|
|
|
* @date 2020/12/18 15:06 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void audit(AuditDraftTopicFormDTO formDTO) { |
|
|
|
|
|
|
|
public void audit(TokenDto tokenDto, AuditDraftTopicFormDTO formDTO) { |
|
|
|
TopicDraftEntity entity = new TopicDraftEntity(); |
|
|
|
entity.setId(formDTO.getTopicDraftId()); |
|
|
|
entity.setDraftReason(formDTO.getReason()); |
|
|
|
entity.setDraftStatus(formDTO.getAuditType()); |
|
|
|
baseDao.updateById(entity); |
|
|
|
if (TopicConstant.APPROVED.equals(formDTO.getAuditType())) { |
|
|
|
TopicDraftEntity draft = baseDao.selectById(formDTO.getTopicDraftId()); |
|
|
|
//将草稿存入话题表
|
|
|
|
ResiTopicEntity resiTopic = ConvertUtils.sourceToTarget(entity, ResiTopicEntity.class); |
|
|
|
resiTopic.setId(null); |
|
|
|
resiTopic.setStatus(TopicConstant.PUBLISHMENT); |
|
|
|
resiTopicDao.insert(resiTopic); |
|
|
|
//将草稿附件存入附件表
|
|
|
|
List<TopicDraftAttachmentDTO> attachmentList = topicDraftAttachmentService.getFileList(formDTO.getTopicDraftId(), null); |
|
|
|
List<ResiTopicAttachmentEntity> topicAttachments = ConvertUtils.sourceToTarget(attachmentList, ResiTopicAttachmentEntity.class); |
|
|
|
topicAttachments.forEach(item -> { |
|
|
|
item.setId(null); |
|
|
|
}); |
|
|
|
resiTopicAttachmentDao.insertBatch(topicAttachments); |
|
|
|
//将音频状态改为approved
|
|
|
|
List<TopicDraftAttachmentDTO> voiceList = |
|
|
|
attachmentList.stream().filter(item -> TopicConstant.VOICE.equals(item.getAttachmentType()) && TopicConstant.REVIEW.equals(item.getStatus())).collect(Collectors.toList()); |
|
|
|
if (CollectionUtils.isNotEmpty(voiceList)) { |
|
|
|
voiceList.forEach(item -> item.setStatus(TopicConstant.APPROVED)); |
|
|
|
topicDraftAttachmentService.updateBatchById(ConvertUtils.sourceToTarget(voiceList, TopicDraftAttachmentEntity.class)); |
|
|
|
} |
|
|
|
} |
|
|
|
//记录操作记录
|
|
|
|
TopicDraftOperationDTO operationDTO = new TopicDraftOperationDTO(); |
|
|
|
operationDTO.setTopicDraftId(formDTO.getTopicDraftId()); |
|
|
|
operationDTO.setOperateType(formDTO.getAuditType()); |
|
|
|
operationDTO.setCreatedBy(tokenDto.getUserId()); |
|
|
|
topicDraftOperationService.save(operationDTO); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|