Browse Source

获取话题附件信息

dev_shibei_match
sunyuchao 5 years ago
parent
commit
a0870b4d22
  1. 9
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java
  2. 23
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/TopicAttachmentFormDTO.java
  3. 30
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/TopicAttachmentResultDTO.java
  4. 13
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java
  5. 8
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicAttachmentDao.java
  6. 7
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java
  7. 36
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java
  8. 18
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicAttachmentDao.xml

9
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java

@ -78,4 +78,13 @@ public interface TopicConstant {
String CREATE_TOPIC = "创建话题失败,话题内容为:%s"; String CREATE_TOPIC = "创建话题失败,话题内容为:%s";
String SHIFT_ISSUE = "转议题失败,标题为:%s , 建议为:%s"; String SHIFT_ISSUE = "转议题失败,标题为:%s , 建议为:%s";
/**
* 附件文件类型
* 图片 - image文档 - doc语音 - voice视频 - video
*/
String FILE_IMAGE = "image";
String FILE_DOC = "doc";
String FILE_VOICE = "voice";
String FILE_VIDEO = "video";
} }

23
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/TopicAttachmentFormDTO.java

@ -0,0 +1,23 @@
package com.epmet.resi.group.dto.topic.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author sun
* @Description 获取话题附件信息-接口入参
*/
@Data
public class TopicAttachmentFormDTO implements Serializable {
private static final long serialVersionUID = -7661839148530902018L;
/**
* 话题ID
*/
@NotBlank(message = "话题ID不能为空",groups = {TopicForm.class})
private String topicId;
public interface TopicForm{}
}

30
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/TopicAttachmentResultDTO.java

@ -0,0 +1,30 @@
package com.epmet.resi.group.dto.topic.result;
import lombok.Data;
import java.io.Serializable;
import java.util.LinkedList;
/**
* @Author sun
* @Description 获取话题附件信息-接口返参
*/
@Data
public class TopicAttachmentResultDTO implements Serializable {
private static final long serialVersionUID = -8606257390921799432L;
/**
* 文件附件Url集合
*/
private LinkedList<String> docList;
/**
* 语音附件Url集合
*/
private LinkedList<String> voiceList;
/**
* 视频附件Url集合
*/
private LinkedList<String> videoList;
}

13
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java

@ -389,4 +389,17 @@ public class ResiTopicController {
response.setStatus(HttpStatus.SC_OK); response.setStatus(HttpStatus.SC_OK);
return new Result<>(); return new Result<>();
} }
/**
* @param formDTO
* @return
* @Author sun
* @Description 获取话题附件信息
**/
@PostMapping(value = "topicattachmentlist")
public Result<TopicAttachmentResultDTO> topicAttachmentList(@RequestBody TopicAttachmentFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, TopicAttachmentFormDTO.TopicForm.class);
return new Result<TopicAttachmentResultDTO>().ok(topicService.topicAttachmentList(formDTO));
}
} }

8
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicAttachmentDao.java

@ -20,7 +20,9 @@ package com.epmet.modules.topic.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.modules.topic.entity.ResiTopicAttachmentEntity; import com.epmet.modules.topic.entity.ResiTopicAttachmentEntity;
import com.epmet.resi.group.dto.topic.ResiTopicAttachmentDTO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -51,4 +53,10 @@ public interface ResiTopicAttachmentDao extends BaseDao<ResiTopicAttachmentEntit
**/ **/
int insertOne(ResiTopicAttachmentEntity attachmentEntity); int insertOne(ResiTopicAttachmentEntity attachmentEntity);
/**
* @Author sun
* @Description 根据话题id查询所有的附件数据
**/
List<ResiTopicAttachmentDTO> selectTopicAttachmentList(@Param("topicId") String topicId);
} }

7
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java

@ -324,4 +324,11 @@ public interface ResiTopicService extends BaseService<ResiTopicEntity> {
*/ */
List<String> getTopicIdsByGroup(String groupId); List<String> getTopicIdsByGroup(String groupId);
/**
* @param formDTO
* @return
* @Author sun
* @Description 获取话题附件信息
**/
TopicAttachmentResultDTO topicAttachmentList(TopicAttachmentFormDTO formDTO);
} }

36
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java

@ -80,6 +80,7 @@ import com.epmet.resi.group.dto.member.ResiGroupMemberDTO;
import com.epmet.resi.group.dto.member.ResiGroupMemberInfoRedisDTO; import com.epmet.resi.group.dto.member.ResiGroupMemberInfoRedisDTO;
import com.epmet.resi.group.dto.member.form.RemoveMemberFormDTO; import com.epmet.resi.group.dto.member.form.RemoveMemberFormDTO;
import com.epmet.resi.group.dto.member.result.ResiGroupMemberInfoRedisResultDTO; import com.epmet.resi.group.dto.member.result.ResiGroupMemberInfoRedisResultDTO;
import com.epmet.resi.group.dto.topic.ResiTopicAttachmentDTO;
import com.epmet.resi.group.dto.topic.ResiTopicDTO; import com.epmet.resi.group.dto.topic.ResiTopicDTO;
import com.epmet.resi.group.dto.topic.TopicInfoDTO; import com.epmet.resi.group.dto.topic.TopicInfoDTO;
import com.epmet.resi.group.dto.topic.form.CheckTopicPublisherFormDTO; import com.epmet.resi.group.dto.topic.form.CheckTopicPublisherFormDTO;
@ -1822,6 +1823,41 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
throw new RenException(reply.getInternalMsg()); throw new RenException(reply.getInternalMsg());
} }
/**
* @param formDTO
* @return
* @Author sun
* @Description 获取话题附件信息
**/
@Override
public TopicAttachmentResultDTO topicAttachmentList(TopicAttachmentFormDTO formDTO) {
TopicAttachmentResultDTO resultDTO = new TopicAttachmentResultDTO();
//1.根据话题id查询所有的附件数据
List<ResiTopicAttachmentDTO> list = resiTopicAttachmentDao.selectTopicAttachmentList(formDTO.getTopicId());
if(list.size()<NumConstant.ONE){
return resultDTO;
}
//2.封装数据并返回
LinkedList<String> docList = new LinkedList<>();
LinkedList<String> voiceList = new LinkedList<>();
LinkedList<String> videoList = new LinkedList<>();
list.forEach(l->{
if(TopicConstant.FILE_DOC.equals(l.getAttachmentType())){
docList.add(l.getAttachmentUrl());
}
if(TopicConstant.FILE_VOICE.equals(l.getAttachmentType())){
voiceList.add(l.getAttachmentUrl());
}
if(TopicConstant.FILE_VIDEO.equals(l.getAttachmentType())){
videoList.add(l.getAttachmentUrl());
}
});
resultDTO.setDocList(docList);
resultDTO.setVoiceList(voiceList);
resultDTO.setVideoList(videoList);
return resultDTO;
}
} }

18
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicAttachmentDao.xml

@ -108,5 +108,23 @@
</foreach> </foreach>
</insert> </insert>
<select id="selectTopicAttachmentList" resultType="com.epmet.resi.group.dto.topic.ResiTopicAttachmentDTO">
SELECT
topic_id,
attachment_name,
attachment_format,
attachment_type,
attachment_url,
sort,
duration
FROM
resi_topic_attachment
WHERE
del_flag = '0'
AND topic_id = #{topicId}
ORDER BY
attachment_type ASC, sort ASC
</select>
</mapper> </mapper>
Loading…
Cancel
Save