Browse Source

回复列表

dev_shibei_match
yinzuomei 4 years ago
parent
commit
3866ab4ece
  1. 33
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/form/InfoRepliesFormDTO.java
  2. 28
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/InfoReplyDetail.java
  3. 18
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/InfoReplyResDTO.java
  4. 18
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/InfoController.java
  5. 33
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetmessage/InfoReceiversDao.java
  6. 12
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/EpmetMessageService.java
  7. 68
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/impl/EpmetMessageServiceImpl.java
  8. 59
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetmessage/InfoReceiversDao.xml

33
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/form/InfoRepliesFormDTO.java

@ -0,0 +1,33 @@
package com.epmet.dataaggre.dto.message.form;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 发送消息详情页-回复列表
* @Author yinzuomei
* @Date 2021/8/20 1:42 下午
*/
@Data
public class InfoRepliesFormDTO extends PageFormDTO implements Serializable {
private static final long serialVersionUID = 8001971787502569463L;
@NotBlank(message = "消息id不能为空",groups = PageFormDTO.AddUserInternalGroup.class)
private String infoId;
//以下参数从token中获取
/**
* 当前用户id
*/
@NotBlank(message = "userId不能为空",groups =PageFormDTO.AddUserInternalGroup.class)
private String userId;
/**
* 当前客户id
*/
@NotBlank(message = "customerId不能为空",groups = PageFormDTO.AddUserInternalGroup.class)
private String customerId;
}

28
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/InfoReplyDetail.java

@ -0,0 +1,28 @@
package com.epmet.dataaggre.dto.message.result;
import com.epmet.commons.tools.dto.form.FileCommonDTO;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Description 发送消息-回复详情
* @Author yinzuomei
* @Date 2021/8/20 2:01 下午
*/
@Data
public class InfoReplyDetail extends StaffInfoCommonDTO implements Serializable {
private static final long serialVersionUID = -9038141920493410767L;
private String replyId;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
private Date replyTime;
private String content;
/**
* 附件列表
*/
private List<FileCommonDTO> attachmentList;
}

18
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/InfoReplyResDTO.java

@ -0,0 +1,18 @@
package com.epmet.dataaggre.dto.message.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description 发送消息-回复列表
* @Author yinzuomei
* @Date 2021/8/20 2:00 下午
*/
@Data
public class InfoReplyResDTO implements Serializable {
private Integer total;
private List<InfoReplyDetail> dataList;
}

18
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/InfoController.java

@ -8,7 +8,9 @@ import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dataaggre.dto.govorg.form.ReceiversFormDTO;
import com.epmet.dataaggre.dto.govorg.result.ReceiversResultDTO;
import com.epmet.dataaggre.dto.message.form.InfoGroupDetailFormDTO;
import com.epmet.dataaggre.dto.message.form.InfoRepliesFormDTO;
import com.epmet.dataaggre.dto.message.result.InfoGroupDetailResDTO;
import com.epmet.dataaggre.dto.message.result.InfoReplyResDTO;
import com.epmet.dataaggre.dto.message.result.MyInfoGroupResultDTO;
import com.epmet.dataaggre.service.epmetmessage.EpmetMessageService;
import org.springframework.web.bind.annotation.PostMapping;
@ -74,4 +76,20 @@ public class InfoController {
ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class);
return new Result<InfoGroupDetailResDTO>().ok(epmetMessageService.queryGroupDetail(formDTO));
}
/**
* 发送消息-消息详情-回复列表分页查询
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dataaggre.dto.message.result.InfoReplyResDTO>
* @author yinzuomei
* @date 2021/8/20 2:09 下午
*/
@PostMapping("replylist")
public Result<InfoReplyResDTO> queryInfoReplies(@LoginUser TokenDto tokenDto,@RequestBody InfoRepliesFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class);
return new Result<InfoReplyResDTO>().ok(epmetMessageService.queryInfoReplies(formDTO));
}
}

33
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetmessage/InfoReceiversDao.java

@ -18,6 +18,9 @@
package com.epmet.dataaggre.dao.epmetmessage;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.commons.tools.dto.form.FileCommonDTO;
import com.epmet.dataaggre.dto.message.result.InfoGroupDetailResDTO;
import com.epmet.dataaggre.dto.message.result.InfoReplyDetail;
import com.epmet.dataaggre.dto.message.result.MyInfoGroupResultDTO;
import com.epmet.dataaggre.entity.epmetmessage.InfoReceiversEntity;
import org.apache.ibatis.annotations.Mapper;
@ -57,4 +60,34 @@ public interface InfoReceiversDao extends BaseDao<InfoReceiversEntity> {
List<String> selectDistinctStaffIds(@Param("staffId") String staffId,
@Param("customerId") String customerId,
@Param("receiverGroupId")String receiverGroupId);
/**
* 根据小组id查询群组基本信息 (群组id, 群组名称)
*
* @param receiverGroupId
* @return com.epmet.dataaggre.dto.message.result.InfoGroupDetailResDTO
* @author yinzuomei
* @date 2021/8/20 2:19 下午
*/
InfoGroupDetailResDTO selectGroupInfo(String receiverGroupId);
/**
* 分页查询消息的回复列表
*
* @param infoId
* @return java.util.List<com.epmet.dataaggre.dto.message.result.InfoReplyDetail>
* @author yinzuomei
* @date 2021/8/20 2:20 下午
*/
List<InfoReplyDetail> selectListReply(String infoId);
/**
* 回复附件
*
* @param replyId
* @return java.util.List<com.epmet.commons.tools.dto.form.FileCommonDTO>
* @author yinzuomei
* @date 2021/8/20 2:31 下午
*/
List<FileCommonDTO> selectReplyAtt(String replyId);
}

12
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/EpmetMessageService.java

@ -3,7 +3,9 @@ package com.epmet.dataaggre.service.epmetmessage;
import com.epmet.dataaggre.dto.govorg.form.ReceiversFormDTO;
import com.epmet.dataaggre.dto.govorg.result.ReceiversResultDTO;
import com.epmet.dataaggre.dto.message.form.InfoGroupDetailFormDTO;
import com.epmet.dataaggre.dto.message.form.InfoRepliesFormDTO;
import com.epmet.dataaggre.dto.message.result.InfoGroupDetailResDTO;
import com.epmet.dataaggre.dto.message.result.InfoReplyResDTO;
import com.epmet.dataaggre.dto.message.result.MyInfoGroupResultDTO;
import java.util.List;
@ -41,4 +43,14 @@ public interface EpmetMessageService {
* @date 2021/8/20 12:59 下午
*/
InfoGroupDetailResDTO queryGroupDetail(InfoGroupDetailFormDTO formDTO);
/**
* 发送消息-消息详情-回复列表分页查询
*
* @param formDTO
* @return com.epmet.dataaggre.dto.message.result.InfoReplyResDTO
* @author yinzuomei
* @date 2021/8/20 2:09 下午
*/
InfoReplyResDTO queryInfoReplies(InfoRepliesFormDTO formDTO);
}

68
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/impl/EpmetMessageServiceImpl.java

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoCache;
import com.epmet.dataaggre.constant.DataSourceConstant;
@ -14,11 +15,12 @@ import com.epmet.dataaggre.dto.govorg.ReceiverDTO;
import com.epmet.dataaggre.dto.govorg.form.ReceiversFormDTO;
import com.epmet.dataaggre.dto.govorg.result.ReceiversResultDTO;
import com.epmet.dataaggre.dto.message.form.InfoGroupDetailFormDTO;
import com.epmet.dataaggre.dto.message.result.InfoGroupDetailResDTO;
import com.epmet.dataaggre.dto.message.result.MyInfoGroupResultDTO;
import com.epmet.dataaggre.dto.message.result.StaffInfoCommonDTO;
import com.epmet.dataaggre.dto.message.form.InfoRepliesFormDTO;
import com.epmet.dataaggre.dto.message.result.*;
import com.epmet.dataaggre.entity.epmetmessage.InfoReceiversEntity;
import com.epmet.dataaggre.service.epmetmessage.EpmetMessageService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -91,6 +93,7 @@ public class EpmetMessageServiceImpl implements EpmetMessageService {
*/
@Override
public List<MyInfoGroupResultDTO> queryMyGroupList(String staffId, String customerId) {
// 按照小组的创建时间升序,新创建在后面, 显示的人员时按照info_group_receivers 群成员表的主键升序
List<MyInfoGroupResultDTO> list = infoReceiversDao.selectMyGroupList(staffId, customerId,null);
if (CollectionUtils.isNotEmpty(list)) {
// 2、遍历每个群组,赋值工作人员姓名列表
@ -119,16 +122,15 @@ public class EpmetMessageServiceImpl implements EpmetMessageService {
*/
@Override
public InfoGroupDetailResDTO queryGroupDetail(InfoGroupDetailFormDTO formDTO) {
List<MyInfoGroupResultDTO> list = infoReceiversDao.selectMyGroupList(formDTO.getUserId(), formDTO.getCustomerId(),formDTO.getReceiverGroupId());
InfoGroupDetailResDTO resDTO = new InfoGroupDetailResDTO();
if (CollectionUtils.isNotEmpty(list)) {
// 2、遍历每个群组,赋值工作人员姓名列表
for (MyInfoGroupResultDTO group : list) {
resDTO.setReceiverGroupId(group.getReceiverGroupId());
resDTO.setName(group.getName());
List<StaffInfoCommonDTO> staffList=new ArrayList<>();
for (String userId : group.getStaffIdList()) {
InfoGroupDetailResDTO resDTO = infoReceiversDao.selectGroupInfo(formDTO.getReceiverGroupId());
if (null == resDTO) {
throw new RenException("info_receiver_group dosen't have record");
}
resDTO.setStaffList(new ArrayList<>());
//按照info_group_receivers 群成员表的主键升序
PageInfo<String> staffIds = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> infoReceiversDao.selectDistinctStaffIds(formDTO.getUserId(), formDTO.getCustomerId(), formDTO.getReceiverGroupId()));
if (CollectionUtils.isNotEmpty(staffIds.getList())) {
for (String userId : staffIds.getList()) {
//查询每个工作人员的基本信息
CustomerStaffInfoCache staffInfoCache = customerStaffRedis.getStaffInfo(formDTO.getCustomerId(), userId);
if (null != staffInfoCache) {
@ -137,18 +139,42 @@ public class EpmetMessageServiceImpl implements EpmetMessageService {
staffInfo.setStaffName(staffInfoCache.getRealName());
staffInfo.setGender(staffInfoCache.getGender().toString());
staffInfo.setHeadPhoto(StringUtils.isNotBlank(staffInfoCache.getHeadPhoto()) ? staffInfoCache.getHeadPhoto() : StrConstant.EPMETY_STR);
// 从网格添加的,显示 XXX-网格名
// 部门添加的,显示XXX-部门名
// 组织添加的,XXX组织名-XXX组织名
String showOrgName="todo";
//todo
staffInfo.setOrgName(showOrgName);
staffList.add(staffInfo);
staffInfo.setOrgName("todo get");
resDTO.getStaffList().add(staffInfo);
}
}
resDTO.setStaffList(staffList);
}
}
return resDTO;
}
/**
* 发送消息-消息详情-回复列表分页查询
*
* @param formDTO
* @return com.epmet.dataaggre.dto.message.result.InfoReplyResDTO
* @author yinzuomei
* @date 2021/8/20 2:09 下午
*/
@Override
public InfoReplyResDTO queryInfoReplies(InfoRepliesFormDTO formDTO) {
InfoReplyResDTO result = new InfoReplyResDTO();
// 按照回复时间降序排列 ,新回复的在最上面
PageInfo<InfoReplyDetail> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> infoReceiversDao.selectListReply(formDTO.getInfoId()));
result.setTotal((int) data.getTotal());
for (InfoReplyDetail detail : data.getList()) {
//查询每个工作人员的基本信息
CustomerStaffInfoCache staffInfoCache = customerStaffRedis.getStaffInfo(formDTO.getCustomerId(), detail.getStaffId());
detail.setStaffName(staffInfoCache.getRealName());
detail.setGender(staffInfoCache.getGender().toString());
detail.setHeadPhoto(StringUtils.isNotBlank(staffInfoCache.getHeadPhoto()) ? staffInfoCache.getHeadPhoto() : StrConstant.EPMETY_STR);
//todo
detail.setOrgName("todo get");
}
result.setDataList(data.getList());
return result;
}
}

59
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetmessage/InfoReceiversDao.xml

@ -23,13 +23,13 @@
left join info_group_receivers igr
on(irg.id=igr.info_receiver_group_id and igr.DEL_FLAG='0')
WHERE
irg.DEL_FLAG = '0'
AND irg.CREATE_STAFF_ID = #{staffId}
AND irg.CUSTOMER_ID = #{customerId}
<if test="null != receiverGroupId and receiverGroupId !=''">
and irg.id=#{receiverGroupId}
</if>
order by irg.CREATED_TIME asc
order by irg.CREATED_TIME asc,igr.id asc
</select>
<!-- 我创建的组内所有的人 -->
@ -48,5 +48,60 @@
<if test="null != receiverGroupId and receiverGroupId !=''">
AND irg.id =#{receiverGroupId}
</if>
order by igr.id asc
</select>
<!-- 根据小组id,查询群组基本信息 -->
<select id="selectGroupInfo" parameterType="java.lang.String" resultType="com.epmet.dataaggre.dto.message.result.InfoGroupDetailResDTO">
SELECT
irg.ID as receiverGroupId,
irg.`NAME` as name
FROM
info_receiver_group irg
where irg.id=#{receiverGroupId}
and irg.DEL_FLAG = '0'
</select>
<resultMap id="InfoReplyDetailMap" type="com.epmet.dataaggre.dto.message.result.InfoReplyDetail">
<result property="replyId" column="id"/>
<result property="replyTime" column="CREATED_TIME"/>
<result property="staffId" column="FROM_USER_ID"/>
<result property="content" column="content"></result>
<collection property="attachmentList" ofType="com.epmet.commons.tools.dto.form.FileCommonDTO" column="id" select="com.epmet.dataaggre.dao.epmetmessage.InfoReceiversDao.selectReplyAtt"/>
</resultMap>
<!-- 分页查询消息的回复列表 -->
<select id="selectListReply" parameterType="java.lang.String" resultMap="InfoReplyDetailMap">
SELECT
ir.id,
ir.CREATED_TIME,
ir.FROM_USER_ID,
( SELECT IFNULL( ipc.CONTENT, '' ) FROM info_reply_content ipc WHERE ipc.REPLY_TYPE = 'text' AND ipc.INFO_REPLY_ID = ir.id and ipc.DEL_FLAG='0') AS content
FROM
info_reply ir
WHERE
ir.DEL_FLAG = '0'
AND ir.INFO_ID = #{infoId}
ORDER BY
ir.CREATED_TIME DESC,
ir.id DESC
</select>
<select id="selectReplyAtt" parameterType="java.lang.String" resultType="com.epmet.commons.tools.dto.form.FileCommonDTO">
SELECT
m.ATTACHMENT_NAME as name,
m.ATTACHMENT_SIZE as size,
M.ATTACHMENT_FORMAT as format,
M.REPLY_TYPE as `type`,
m.CONTENT as url,
m.DURATION as duration
FROM
info_reply_content m
WHERE
m.DEL_FLAG = '0'
AND m.INFO_REPLY_ID = ''
AND m.REPLY_TYPE != 'text'
ORDER BY
m.SORT ASC
</select>
</mapper>
Loading…
Cancel
Save