Browse Source

mysent

dev_shibei_match
yinzuomei 4 years ago
parent
commit
fab731eb5b
  1. 33
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/form/MySentFormDTO.java
  2. 29
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/MySentResDTO.java
  3. 19
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/InfoController.java
  4. 46
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetmessage/InfoProfileDao.java
  5. 78
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetmessage/InfoProfileEntity.java
  6. 12
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/EpmetMessageService.java
  7. 17
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/impl/EpmetMessageServiceImpl.java
  8. 52
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetmessage/InfoProfileDao.xml
  9. 4
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetmessage/InfoReceiversDao.xml
  10. 3
      epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.16__add_infocontent_idx.sql

33
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/form/MySentFormDTO.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 2:58 下午
*/
@Data
public class MySentFormDTO extends PageFormDTO implements Serializable {
private static final long serialVersionUID = 2007425752362914036L;
private String content;
//以下参数从token中获取
/**
* 当前用户id
*/
@NotBlank(message = "userId不能为空",groups =PageFormDTO.AddUserInternalGroup.class)
private String userId;
/**
* 当前客户id
*/
@NotBlank(message = "customerId不能为空",groups = PageFormDTO.AddUserInternalGroup.class)
private String customerId;
}

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

@ -0,0 +1,29 @@
package com.epmet.dataaggre.dto.message.result;
import com.epmet.commons.tools.dto.form.FileCommonDTO;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Description 我发送的消息列表
* @Author yinzuomei
* @Date 2021/8/20 3:01 下午
*/
@Data
public class MySentResDTO implements Serializable {
private static final long serialVersionUID = -6765856639039569052L;
private String infoId;
private String content;
private Date publishTime;
private Integer totalReceiver;
private Integer readTotal;
private String firstAttId;
/**
* 附件列表 列表默认返回一个
*/
private List<FileCommonDTO> attachmentList;
}

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

@ -9,10 +9,12 @@ 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.form.MySentFormDTO;
import com.epmet.dataaggre.dto.message.result.InfoGroupDetailResDTO;
import com.epmet.dataaggre.dto.message.result.InfoRedDotResultDTO;
import com.epmet.dataaggre.dto.message.result.InfoReplyResDTO;
import com.epmet.dataaggre.dto.message.result.MyInfoGroupResultDTO;
import com.epmet.dataaggre.dto.message.result.MySentResDTO;
import com.epmet.dataaggre.service.epmetmessage.EpmetMessageService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -105,4 +107,21 @@ public class InfoController {
return new Result<InfoRedDotResultDTO>().ok(epmetMessageService.redDot(tokenDto.getUserId()));
}
/**
* 发送消息-我发送的列表 可根据内容搜索
*
* @param tokenDto
* @param mySentFormDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dataaggre.dto.message.result.MySentResDTO>>
* @author yinzuomei
* @date 2021/8/20 3:02 下午
*/
@PostMapping("sentlist")
public Result<List<MySentResDTO>> queryMySent(@LoginUser TokenDto tokenDto, @RequestBody MySentFormDTO mySentFormDTO){
mySentFormDTO.setCustomerId(tokenDto.getCustomerId());
mySentFormDTO.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(mySentFormDTO,PageFormDTO.AddUserInternalGroup.class);
return new Result<List<MySentResDTO>>().ok(epmetMessageService.queryMySent(mySentFormDTO));
}
}

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

@ -0,0 +1,46 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dataaggre.dao.epmetmessage;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.dto.message.result.MySentResDTO;
import com.epmet.dataaggre.entity.epmetmessage.InfoProfileEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 消息概要表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-08-18
*/
@Mapper
public interface InfoProfileDao extends BaseDao<InfoProfileEntity> {
/**
* 我发出的消息列表
*
* @param publishStaffId
* @return java.util.List<com.epmet.dataaggre.dto.message.result.MySentResDTO>
* @author yinzuomei
* @date 2021/8/20 3:46 下午
*/
List<MySentResDTO> selectListMySent(@Param("publishStaffId") String publishStaffId,@Param("content") String content);
}

78
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetmessage/InfoProfileEntity.java

@ -0,0 +1,78 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dataaggre.entity.epmetmessage;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 消息概要表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-08-18
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("info_profile")
public class InfoProfileEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* 消息主表的id
*/
private String infoId;
/**
* 发布人id
*/
private String publishStaffId;
/**
* 内容概要取前100字
*/
private String content;
/**
* 附件ID第一个用于展示
*/
private String firstAttId;
/**
* 应读人数
*/
private Integer totalReceiver;
/**
* 已读人数插入是为0
*/
private Integer readTotal;
/**
* 未读的回复数量发布人每次查看详情后置为0接收人回复一条+1
*/
private Integer unReadReplyNum;
}

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

@ -4,10 +4,12 @@ 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.form.MySentFormDTO;
import com.epmet.dataaggre.dto.message.result.InfoGroupDetailResDTO;
import com.epmet.dataaggre.dto.message.result.InfoRedDotResultDTO;
import com.epmet.dataaggre.dto.message.result.InfoReplyResDTO;
import com.epmet.dataaggre.dto.message.result.MyInfoGroupResultDTO;
import com.epmet.dataaggre.dto.message.result.MySentResDTO;
import java.util.List;
@ -62,4 +64,14 @@ public interface EpmetMessageService {
* @date 2021/8/20 3:38 下午
*/
InfoRedDotResultDTO redDot(String userId);
/**
* 发送消息-我发送的列表 可根据内容搜索
*
* @param mySentFormDTO
* @return java.util.List<com.epmet.dataaggre.dto.message.result.MySentResDTO>
* @author yinzuomei
* @date 2021/8/20 3:03 下午
*/
List<MySentResDTO> queryMySent(MySentFormDTO mySentFormDTO);
}

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

@ -10,12 +10,14 @@ import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.dao.epmetmessage.InfoProfileDao;
import com.epmet.dataaggre.dao.epmetmessage.InfoReceiversDao;
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.InfoRepliesFormDTO;
import com.epmet.dataaggre.dto.message.form.MySentFormDTO;
import com.epmet.dataaggre.dto.message.result.*;
import com.epmet.dataaggre.entity.epmetmessage.InfoReceiversEntity;
import com.epmet.dataaggre.service.epmetmessage.EpmetMessageService;
@ -45,6 +47,8 @@ public class EpmetMessageServiceImpl implements EpmetMessageService {
private InfoReceiversDao infoReceiversDao;
@Autowired
private CustomerStaffRedis customerStaffRedis;
@Autowired
private InfoProfileDao infoProfileDao;
/**
* @param formDTO
@ -190,5 +194,18 @@ public class EpmetMessageServiceImpl implements EpmetMessageService {
return null;
}
/**
* 发送消息-我发送的列表 可根据内容搜索
*
* @param formDTO
* @return java.util.List<com.epmet.dataaggre.dto.message.result.MySentResDTO>
* @author yinzuomei
* @date 2021/8/20 3:03 下午
*/
@Override
public List<MySentResDTO> queryMySent(MySentFormDTO formDTO) {
PageInfo<MySentResDTO> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> infoProfileDao.selectListMySent(formDTO.getUserId(),formDTO.getContent()));
return data.getList();
}
}

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

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dataaggre.dao.epmetmessage.InfoProfileDao">
<resultMap id="MySentResDTOMap" type="com.epmet.dataaggre.dto.message.result.MySentResDTO">
<id property="infoId" column="id" />
<result property="content" column="content"/>
<result property="publishTime" column="CREATED_TIME"/>
<result property="totalReceiver" column="total_receiver"/>
<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=""/>
</collection>
</resultMap>
<!-- 我发出的消息列表-->
<select id="selectListMySent" parameterType="java.lang.String" resultMap="MySentResDTOMap">
select
i.id,
ip.content,
i.CREATED_TIME,
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
from info_profile ip
inner join info i
on(ip.INFO_ID=i.id)
left join info_att ia
on(ip.first_att_id=ia.id and ia.DEL_FLAG='0')
where ip.DEL_FLAG='0'
and i.DEL_FLAG='0'
and i.publish_staff_id=#{publishStaffId}
<if test="null != content and content !=''">
i.content like concat('%',#{content},'%')
</if>
order by i.CREATED_TIME desc
</select>
</mapper>

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

@ -4,7 +4,7 @@
<mapper namespace="com.epmet.dataaggre.dao.epmetmessage.InfoReceiversDao">
<resultMap id="MyInfoGroupResultDTOMap" type="com.epmet.dataaggre.dto.message.result.MyInfoGroupResultDTO">
<result property="receiverGroupId" column="receiverGroupId"/>
<id property="receiverGroupId" column="receiverGroupId" />
<result property="name" column="name"/>
<result property="totalMem" column="totalMem"/>
<collection property="staffIdList" ofType="java.lang.String">
@ -63,7 +63,7 @@
</select>
<resultMap id="InfoReplyDetailMap" type="com.epmet.dataaggre.dto.message.result.InfoReplyDetail">
<result property="replyId" column="id"/>
<id property="replyId" column="id" />
<result property="replyTime" column="CREATED_TIME"/>
<result property="staffId" column="FROM_USER_ID"/>
<result property="content" column="content"></result>

3
epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.16__add_infocontent_idx.sql

@ -1 +1,2 @@
alter table info add fulltext index idx_fulltext_infocontent(content);
alter table info add fulltext index idx_fulltext_infocontent(content) WITH PARSER ngram;
drop index idx_fulltext_infocontent on info;

Loading…
Cancel
Save