Browse Source

详情

dev_shibei_match
yinzuomei 4 years ago
parent
commit
dc3d236466
  1. 36
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/form/InfoIdDTO.java
  2. 97
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/InfoDetailResDTO.java
  3. 2
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/MyReceivedResDTO.java
  4. 2
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/MySentResDTO.java
  5. 17
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/InfoController.java
  6. 14
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetmessage/InfoProfileDao.java
  7. 11
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/EpmetMessageService.java
  8. 41
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/impl/EpmetMessageServiceImpl.java
  9. 106
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetmessage/InfoProfileDao.xml
  10. 12
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetmessage/InfoReceiversDao.xml

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

@ -0,0 +1,36 @@
package com.epmet.dataaggre.dto.message.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 通用dto
* @Author yinzuomei
* @Date 2021/8/20 7:48 下午
*/
@Data
public class InfoIdDTO implements Serializable {
private static final long serialVersionUID = -3852837936492128925L;
public interface AddUserInternalGroup {
}
@NotBlank(message = "消息id不能为空",groups = AddUserInternalGroup.class)
private String infoId;
//以下参数从token中获取
/**
* 当前用户id
*/
@NotBlank(message = "userId不能为空",groups = AddUserInternalGroup.class)
private String userId;
/**
* 当前客户id
*/
@NotBlank(message = "customerId不能为空",groups = AddUserInternalGroup.class)
private String customerId;
}

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

@ -0,0 +1,97 @@
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 7:49 下午
*/
@Data
public class InfoDetailResDTO implements Serializable {
private String infoId;
/**
* 发布人头像
*/
private String headPhoto;
/**
* 发布人id
*/
private String publishStaffId;
/**
* 发布人姓名
*/
private String publishStaffName;
/**
* 发布人2级组织名
*/
private String publishOrgName;
/**
* 发布人性别
*/
private String publishStaffGender;
/**
* 是否本人发布true:是当前用户发布
*/
private Boolean isMine;
/**
* 消息内容完整版
*/
private String content;
/**
* 发送时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
private Date publishTime;
/**
* 共XX个接收人
*/
private Integer totalReceiver;
/**
* 已读的数量
*/
private Integer readTotal;
/**
* 未读的数量
*/
private Integer unReadCount;
/**
* 第一个接受人的id
*/
//@JsonIgnore
private String firstReceiverStaffId;
/**
* 第一个接受人的姓名
*/
private String firstReceiverName;
/**
* 未读的回复数量
*/
private Integer unReadReplyNum;
/**
* 附件列表
*/
private List<FileCommonDTO> attachmentList;
}

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

@ -1,6 +1,7 @@
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;
@ -20,6 +21,7 @@ public class MyReceivedResDTO implements Serializable {
private String publishStaffOrgName;
private String headPhoto;
private String content;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
private Date publishTime;
/**
* 附件列表 列表默认返回一个

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

@ -1,6 +1,7 @@
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;
@ -17,6 +18,7 @@ public class MySentResDTO implements Serializable {
private static final long serialVersionUID = -6765856639039569052L;
private String infoId;
private String content;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
private Date publishTime;
private Integer totalReceiver;
private Integer readTotal;

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

@ -8,6 +8,7 @@ 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.InfoIdDTO;
import com.epmet.dataaggre.dto.message.form.InfoRepliesFormDTO;
import com.epmet.dataaggre.dto.message.form.MySentFormDTO;
import com.epmet.dataaggre.dto.message.result.*;
@ -138,4 +139,20 @@ public class InfoController {
return new Result<List<MyReceivedResDTO>>().ok(epmetMessageService.queryMyReceivedList(formDTO));
}
/**
* 消息详情我收到的我发送的通用
*
* @param tokenDto
* @param infoIdDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dataaggre.dto.message.result.InfoDetailResDTO>
* @author yinzuomei
* @date 2021/8/20 7:57 下午
*/
@PostMapping("infodetail")
public Result<InfoDetailResDTO> queryInfoDetail(@LoginUser TokenDto tokenDto,@RequestBody InfoIdDTO infoIdDTO){
infoIdDTO.setCustomerId(tokenDto.getCustomerId());
infoIdDTO.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(infoIdDTO,InfoIdDTO.AddUserInternalGroup.class);
return new Result<InfoDetailResDTO>().ok(epmetMessageService.queryInfoDetail(infoIdDTO));
}
}

14
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetmessage/InfoProfileDao.java

@ -18,6 +18,8 @@
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.InfoDetailResDTO;
import com.epmet.dataaggre.dto.message.result.MyReceivedResDTO;
import com.epmet.dataaggre.dto.message.result.MySentResDTO;
import com.epmet.dataaggre.entity.epmetmessage.InfoProfileEntity;
@ -55,4 +57,16 @@ public interface InfoProfileDao extends BaseDao<InfoProfileEntity> {
* @date 2021/8/20 7:01 下午
*/
List<MyReceivedResDTO> selectListMyReceived(@Param("userId") String userId, @Param("content") String content);
/**
* 消息详情
*
* @param infoId
* @return com.epmet.dataaggre.dto.message.result.InfoDetailResDTO
* @author yinzuomei
* @date 2021/8/20 7:58 下午
*/
InfoDetailResDTO selectInfoDetail(String infoId);
List<FileCommonDTO> selectInfoAtt(String infoId);
}

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

@ -3,6 +3,7 @@ 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.InfoIdDTO;
import com.epmet.dataaggre.dto.message.form.InfoRepliesFormDTO;
import com.epmet.dataaggre.dto.message.form.MySentFormDTO;
import com.epmet.dataaggre.dto.message.result.*;
@ -80,4 +81,14 @@ public interface EpmetMessageService {
* @date 2021/8/20 7:00 下午
*/
List<MyReceivedResDTO> queryMyReceivedList(MySentFormDTO formDTO);
/**
* 消息详情我收到的我发送的通用
*
* @param infoIdDTO
* @return com.epmet.dataaggre.dto.message.result.InfoDetailResDTO
* @author yinzuomei
* @date 2021/8/20 7:57 下午
*/
InfoDetailResDTO queryInfoDetail(InfoIdDTO infoIdDTO);
}

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

@ -16,6 +16,7 @@ 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.form.InfoIdDTO;
import com.epmet.dataaggre.dto.message.form.InfoRepliesFormDTO;
import com.epmet.dataaggre.dto.message.form.MySentFormDTO;
import com.epmet.dataaggre.dto.message.result.*;
@ -221,7 +222,47 @@ public class EpmetMessageServiceImpl implements EpmetMessageService {
public List<MyReceivedResDTO> queryMyReceivedList(MySentFormDTO formDTO) {
PageInfo<MyReceivedResDTO> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize())
.doSelectPageInfo(() -> infoProfileDao.selectListMyReceived(formDTO.getUserId(),formDTO.getContent()));
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId());
for(MyReceivedResDTO resDTO: data.getList()){
resDTO.setHeadPhoto(StringUtils.isNotBlank(staffInfoCache.getHeadPhoto()) ? staffInfoCache.getHeadPhoto() : StrConstant.EPMETY_STR);
resDTO.setPublishStaffGender(String.valueOf(staffInfoCache.getGender()));
resDTO.setPublishStaffOrgName(staffInfoCache.getTwoOrgName());
resDTO.setPublishStaffName(staffInfoCache.getRealName());
}
return data.getList();
}
/**
* 消息详情我收到的我发送的通用
*
* @param infoIdDTO
* @return com.epmet.dataaggre.dto.message.result.InfoDetailResDTO
* @author yinzuomei
* @date 2021/8/20 7:57 下午
*/
@Override
public InfoDetailResDTO queryInfoDetail(InfoIdDTO infoIdDTO) {
InfoDetailResDTO resDTO=infoProfileDao.selectInfoDetail(infoIdDTO.getInfoId());
if(null!=resDTO){
if (resDTO.getPublishStaffId().equals(infoIdDTO.getUserId())) {
resDTO.setIsMine(true);
} else {
resDTO.setIsMine(false);
}
resDTO.setAttachmentList(infoProfileDao.selectInfoAtt(infoIdDTO.getInfoId()));
if(StringUtils.isNotBlank(resDTO.getPublishStaffId())){
CustomerStaffInfoCacheResult publisher = CustomerStaffRedis.getStaffInfo(infoIdDTO.getCustomerId(), resDTO.getPublishStaffId());
resDTO.setHeadPhoto(StringUtils.isNotBlank(publisher.getHeadPhoto()) ? publisher.getHeadPhoto() : StrConstant.EPMETY_STR);
resDTO.setPublishOrgName(publisher.getTwoOrgName());
resDTO.setPublishStaffGender(publisher.getGender().toString());
resDTO.setPublishStaffName(publisher.getRealName());
}
if(StringUtils.isNotBlank(resDTO.getFirstReceiverStaffId())){
CustomerStaffInfoCacheResult first = CustomerStaffRedis.getStaffInfo(infoIdDTO.getCustomerId(), resDTO.getFirstReceiverStaffId());
resDTO.setFirstReceiverName(first.getRealName());
}
}
return resDTO;
}
}

106
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetmessage/InfoProfileDao.xml

@ -11,12 +11,12 @@
<result property="readTotal" column="read_total"/>
<result property="firstAttId" column="first_att_id"/>
<collection property="attachmentList" ofType="com.epmet.commons.tools.dto.form.FileCommonDTO" >
<result property="name" column=""/>
<result property="url" column=""/>
<result property="type" column=""/>
<result property="format" column=""/>
<result property="size" column=""/>
<result property="duration" column=""/>
<result property="name" column="name"/>
<result property="url" column="url"/>
<result property="type" column="type"/>
<result property="format" column="format"/>
<result property="size" column="size"/>
<result property="duration" column="duration"/>
</collection>
</resultMap>
@ -29,12 +29,16 @@
ip.total_receiver,
ip.read_total,
ip.first_att_id,
IFNULL(ia.ATTACHMENT_NAME,'') AS name,
IFNULL(ia.ATTACHMENT_FORMAT,'') AS format,
IFNULL(ia.ATTACHMENT_TYPE,'') AS type,
IFNULL(ia.ATTACHMENT_URL,'') AS url,
IFNULL(ia.ATTACHMENT_SIZE,'') AS size,
IFNULL(ia.DURATION,'') AS duration
ia.ATTACHMENT_NAME AS name,
ia.ATTACHMENT_FORMAT AS format,
ia.ATTACHMENT_TYPE AS type,
ia.ATTACHMENT_URL AS url,
(case when ip.first_att_id is null or ip.first_att_id='' then null
else ia.ATTACHMENT_SIZE
end) as size,
(case when ip.first_att_id is null or ip.first_att_id='' then null
else ia.duration
end) as duration
from info_profile ip
inner join info i
on(ip.INFO_ID=i.id)
@ -44,24 +48,24 @@
and i.DEL_FLAG='0'
and i.publish_staff_id=#{publishStaffId}
<if test="null != content and content !=''">
i.content like concat('%',trim(#{content}),'%')
and i.content like concat('%',trim(#{content}),'%')
</if>
order by i.CREATED_TIME desc
</select>
<resultMap id="MyReceivedResDTOMap" type="com.epmet.dataaggre.dto.message.result.MyReceivedResDTO">
<id property="infoId" column="id" />
<id property="infoId" column="INFO_ID" />
<result property="content" column="content"/>
<result property="publishTime" column="CREATED_TIME"/>
<result property="firstAttId" column="first_att_id"/>
<result property="readFlag" column="read_flag"/>
<result property="readFlag" column="READ_FLAG"/>
<collection property="attachmentList" ofType="com.epmet.commons.tools.dto.form.FileCommonDTO" >
<result property="name" column=""/>
<result property="url" column=""/>
<result property="type" column=""/>
<result property="format" column=""/>
<result property="size" column=""/>
<result property="duration" column=""/>
<result property="name" column="name"/>
<result property="url" column="url"/>
<result property="type" column="type"/>
<result property="format" column="format"/>
<result property="size" column="size"/>
<result property="duration" column="duration"/>
</collection>
</resultMap>
<select id="selectListMyReceived" parameterType="map" resultMap="MyReceivedResDTOMap">
@ -71,25 +75,65 @@
ii.CREATED_TIME,
ir.READ_FLAG,
ip.first_att_id,
IFNULL(ia.ATTACHMENT_NAME,'') AS name,
IFNULL(ia.ATTACHMENT_FORMAT,'') AS format,
IFNULL(ia.ATTACHMENT_TYPE,'') AS type,
IFNULL(ia.ATTACHMENT_URL,'') AS url,
IFNULL(ia.ATTACHMENT_SIZE,'') AS size,
IFNULL(ia.DURATION,'') AS duration
ia.ATTACHMENT_NAME AS name,
ia.ATTACHMENT_FORMAT AS format,
ia.ATTACHMENT_TYPE AS type,
ia.ATTACHMENT_URL AS url,
(case when ip.first_att_id is null or ip.first_att_id='' then null
else ia.ATTACHMENT_SIZE
end) as size,
(case when ip.first_att_id is null or ip.first_att_id='' then null
else ia.duration
end) as duration
FROM
info_receivers ir
INNER JOIN info ii ON ( ir.INFO_ID = ii.ID )
INNER JOIN info_profile ip ON ( ii.ID = ip.INFO_ID AND ip.DEL_FLAG = '0' )
LEFT JOIN info_att ia ( ip.first_att_id = ia.id AND ia.DEL_FLAG = '0' )
INNER JOIN info ii ON ( ir.INFO_ID = ii.ID )
INNER JOIN info_profile ip ON ( ii.ID = ip.INFO_ID AND ip.DEL_FLAG = '0' )
LEFT JOIN info_att ia on ( ip.first_att_id = ia.id AND ia.DEL_FLAG = '0' )
WHERE
ir.DEL_FLAG = '0'
AND ii.DEL_FLAG = '0'
AND ir.STAFF_ID = #{userId}
<if test="null != content and content !=''">
ii.content like concat('%',trim(#{content}),'%')
and ii.content like concat('%',trim(#{content}),'%')
</if>
ORDER BY
ii.CREATED_TIME DESC
</select>
<select id="selectInfoDetail" parameterType="java.lang.String" resultType="com.epmet.dataaggre.dto.message.result.InfoDetailResDTO">
select
ii.id as infoId,
ii.publish_staff_id as publishStaffId,
ii.content,
ii.CREATED_TIME as publishTime,
ip.total_receiver as totalReceiver,
ip.read_total as readTotal,
ip.total_receiver-ip.read_total as unReadCount,
(
select ir.STAFF_ID from info_receivers ir
where ir.INFO_ID=#{infoId}
and ir.DEL_FLAG='0'
order by ir.id asc limit 1
) as firstReceiverStaffId,
ip.UN_READ_REPLY_NUM as unReadReplyNum
from info ii
inner join info_profile ip
on(ii.id=ip.INFO_ID)
where ii.DEL_FLAG='0'
and ii.ID=#{infoId}
</select>
<select id="selectInfoAtt" parameterType="java.lang.String" resultType="com.epmet.commons.tools.dto.form.FileCommonDTO">
select
ia.ATTACHMENT_NAME AS name,
ia.ATTACHMENT_FORMAT AS format,
ia.ATTACHMENT_TYPE AS type,
ia.ATTACHMENT_URL AS url,
ia.ATTACHMENT_SIZE as size,
ia.duration
from info_att ia
where ia.info_id=#{infoId}
and ia.DEL_FLAG = '0'
order by ia.sort asc
</select>
</mapper>

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

@ -90,11 +90,19 @@
<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,
(
case when m.ATTACHMENT_NAME is null or m.ATTACHMENT_NAME='' then null
else m.ATTACHMENT_SIZE
end
) as size,
M.ATTACHMENT_FORMAT as format,
M.REPLY_TYPE as `type`,
m.CONTENT as url,
m.DURATION as duration
(
case when m.ATTACHMENT_NAME is null or m.ATTACHMENT_NAME='' then null
else m.DURATION
end
)as duration
FROM
info_reply_content m
WHERE

Loading…
Cancel
Save