Commit 8663d9e9 by 吴博

feat: [1006312]– 【优化】自驱-小程序页面展示:一级页消息(层级)优化

parent b0df64e7
......@@ -29,4 +29,13 @@ public class AppletNotifySendDTO {
private String extJson;
private Integer serveType;
@ApiModelProperty("消息创建人id")
private Long createUserId;
@ApiModelProperty("创建人角色 pc or wx")
private String createUserRole;
@ApiModelProperty("内容")
private String content;
}
package com.pcloud.book.cultivate.enums;
public enum NotifyCreateRoleEnum {
PC("pc", "pc端"),
WX("wx", "客户端");
public String code;
public String desc;
NotifyCreateRoleEnum(String code, String desc) {
this.code = code;
this.desc = desc;
}
}
package com.pcloud.book.cultivate.biz.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.StrUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
......@@ -59,6 +60,7 @@ import com.pcloud.readercenter.applet.entity.AppletQuestion;
import com.pcloud.readercenter.common.utils.ReaderConstants;
import com.pcloud.readercenter.wechat.dto.MiniUserDto;
import com.pcloud.readercenter.wechat.dto.ReaderMessageDto;
import com.pcloud.readercenter.wechat.entity.WechatUser;
import com.pcloud.resourcecenter.product.dto.ProductDto;
import com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto;
import com.pcloud.wechatgroup.selfrobot.dto.SendMessageDTO;
......@@ -170,11 +172,13 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
@Override
public PageBeanNew<CultivateNotifyDTO> getNotifyListByType(Long wechatUserId, Integer messageType,Integer currentPage,Integer numPerPage) {
Map<String,Object> map=new HashMap<>();
map.put("wechatUserId",wechatUserId);
map.put("messageType",messageType);
PageBeanNew<CultivateNotifyDTO> pageBeanNew= cultivateNotifySendDao.listPageNew(new PageParam(currentPage, numPerPage), map, "getNotifyListByType");
map.put("wechatUserId", wechatUserId);
map.put("messageType", messageType);
PageBeanNew<CultivateNotifyDTO> pageBeanNew = cultivateNotifySendDao.listPageNew(new PageParam(currentPage, numPerPage), map, "getNotifyListByType");
List<CultivateNotifyItem> cultivateNotifyItemList = new ArrayList<>();
for (CultivateNotifyDTO cultivateNotifyDTO:pageBeanNew.getRecordList()) {
//填充用户信息
fillUserInfo(pageBeanNew.getRecordList());
for (CultivateNotifyDTO cultivateNotifyDTO : pageBeanNew.getRecordList()) {
List<CultivateNotifyItem> cultivateNotifyItems = new ArrayList<>();
List<CultivateNotifyItem> list1=cultivateNotifyItemDao.getNotifyItemsByMessageId(cultivateNotifyDTO.getMessageId());
List<CultivateNotifyItem> list2=cultivateNotifyItemDao.getNotifyItemsByMessageId4Jump(cultivateNotifyDTO.getMessageId());
......@@ -204,6 +208,22 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
return pageBeanNew;
}
private void fillUserInfo(List<CultivateNotifyDTO> recordList) {
if (ListUtils.isEmpty(recordList)) {
return;
}
List<Long> wechatUserIds = recordList.stream().map(e -> e.getWechatUserId()).collect(Collectors.toList());
if (CollUtil.isEmpty(wechatUserIds)) {
return;
}
Map<Long, WechatUser> wechatUserMap = readerConsr.getUserList(wechatUserIds);
recordList.stream().forEach(e -> {
if (CollUtil.isNotEmpty(wechatUserMap) && null != wechatUserMap.get(e.getWechatUserId())) {
e.setWechatUser(wechatUserMap.get(e.getWechatUserId()));
}
});
}
private void fillResource(List<CultivateNotifyItem> list){
List<Long> resourceIds=new ArrayList<>();
for (CultivateNotifyItem notifyItem : list){
......@@ -661,6 +681,8 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
cultivateNotify.setTitle(newSendDTO.getTitle());
cultivateNotify.setSendType(newSendDTO.getSendType());
cultivateNotify.setAgentId(0L);
cultivateNotify.setCreateUserId(newSendDTO.getCreateUserId());
cultivateNotify.setCreateUserRole(newSendDTO.getCreateUserRole());
cultivateNotifyDao.insert(cultivateNotify);
CultivateNotifyItem cultivateNotifyItem = new CultivateNotifyItem();
cultivateNotifyItem.setMessageId(cultivateNotify.getMessageId());
......@@ -699,6 +721,8 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
}
//填充资讯应用作品问题
fillAppOrProduct4Notify(cultivateNotifyItemList);
//填充发送用户信息
fillUserInfo(pageBeanNew.getRecordList());
ThreadPoolUtils.OTHER_THREAD_POOL.execute(() -> {
//批量更新消息已读未读
if (null != pageBeanNew && !ListUtils.isEmpty(pageBeanNew.getRecordList())) {
......@@ -719,6 +743,8 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
cultivateNotify.setTitle(newSendDTO.getTitle());
cultivateNotify.setSendType(newSendDTO.getSendType());
cultivateNotify.setAgentId(0L);
cultivateNotify.setCreateUserId(newSendDTO.getCreateUserId());
cultivateNotify.setCreateUserRole(newSendDTO.getCreateUserRole());
cultivateNotifyDao.insert(cultivateNotify);
CultivateNotifyItem cultivateNotifyItem = new CultivateNotifyItem();
cultivateNotifyItem.setMessageId(cultivateNotify.getMessageId());
......
......@@ -2,6 +2,7 @@ package com.pcloud.book.cultivate.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.book.cultivate.entity.CultivateNotifyItem;
import com.pcloud.readercenter.wechat.entity.WechatUser;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -71,4 +72,15 @@ public class CultivateNotifyDTO {
@ApiModelProperty("首页推图")
private String squareImg;
@ApiModelProperty("用户id")
private Long wechatUserId;
@ApiModelProperty("微信用户信息")
private WechatUser wechatUser;
@ApiModelProperty("内容")
private String content;
private Integer serveType;
}
......@@ -30,4 +30,8 @@ public class CultivateNotify extends BaseEntity {
@ApiModelProperty("首页推图")
private String squareImg;
private Long createUserId;
private String createUserRole;
}
......@@ -19,26 +19,26 @@
<insert id="insert" parameterType="com.pcloud.book.cultivate.entity.CultivateNotify" useGeneratedKeys="true" keyProperty="messageId">
insert into cultivate_notify
(
message_type,
title,
create_time,
update_time,
send_type,
agent_id,
show_home,
square_img
)
values (
#{messageType},
#{title},
NOW(),
NOW(),
#{sendType},
#{agentId},
#{showHome},
#{squareImg}
)
(message_type,
title,
create_time,
update_time,
send_type,
agent_id,
show_home,
square_img,
create_user_id,
create_user_role)
values (#{messageType},
#{title},
NOW(),
NOW(),
#{sendType},
#{agentId},
#{showHome},
#{squareImg},
#{createUserId},
#{createUserRole})
</insert>
<update id="update" parameterType="com.pcloud.book.cultivate.entity.CultivateNotify">
......
......@@ -118,15 +118,21 @@
group by message_type
</select>
<select id="getNotifyListByType" parameterType="map" resultType="com.pcloud.book.cultivate.dto.CultivateNotifyDTO">
select a.message_id messageId ,a.title,a.message_type messageType ,c.create_time sendTime from cultivate_notify a, cultivate_notify_send c
where a.message_id=c.message_id
and c.wechat_user_id=#{wechatUserId}
<if test="messageType != null">
and c.message_type=#{messageType}
</if>
order by c.create_time desc
</select>
<select id="getNotifyListByType" parameterType="map" resultType="com.pcloud.book.cultivate.dto.CultivateNotifyDTO">
select a.message_id messageId,
a.title,
a.message_type messageType,
c.create_time sendTime,
a.create_user_id wechatUserId
from cultivate_notify a,
cultivate_notify_send c
where a.message_id = c.message_id
and c.wechat_user_id = #{wechatUserId}
<if test="messageType != null">
and c.message_type = #{messageType}
</if>
order by c.create_time desc
</select>
<select id="getNotifySendsByType" parameterType="map" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> from cultivate_notify_send
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment