Commit 8663d9e9 by 吴博

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

parent b0df64e7
...@@ -29,4 +29,13 @@ public class AppletNotifySendDTO { ...@@ -29,4 +29,13 @@ public class AppletNotifySendDTO {
private String extJson; private String extJson;
private Integer serveType; 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; package com.pcloud.book.cultivate.biz.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
...@@ -59,6 +60,7 @@ import com.pcloud.readercenter.applet.entity.AppletQuestion; ...@@ -59,6 +60,7 @@ import com.pcloud.readercenter.applet.entity.AppletQuestion;
import com.pcloud.readercenter.common.utils.ReaderConstants; import com.pcloud.readercenter.common.utils.ReaderConstants;
import com.pcloud.readercenter.wechat.dto.MiniUserDto; import com.pcloud.readercenter.wechat.dto.MiniUserDto;
import com.pcloud.readercenter.wechat.dto.ReaderMessageDto; import com.pcloud.readercenter.wechat.dto.ReaderMessageDto;
import com.pcloud.readercenter.wechat.entity.WechatUser;
import com.pcloud.resourcecenter.product.dto.ProductDto; import com.pcloud.resourcecenter.product.dto.ProductDto;
import com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto; import com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto;
import com.pcloud.wechatgroup.selfrobot.dto.SendMessageDTO; import com.pcloud.wechatgroup.selfrobot.dto.SendMessageDTO;
...@@ -170,11 +172,13 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz { ...@@ -170,11 +172,13 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
@Override @Override
public PageBeanNew<CultivateNotifyDTO> getNotifyListByType(Long wechatUserId, Integer messageType,Integer currentPage,Integer numPerPage) { public PageBeanNew<CultivateNotifyDTO> getNotifyListByType(Long wechatUserId, Integer messageType,Integer currentPage,Integer numPerPage) {
Map<String,Object> map=new HashMap<>(); Map<String,Object> map=new HashMap<>();
map.put("wechatUserId",wechatUserId); map.put("wechatUserId", wechatUserId);
map.put("messageType",messageType); map.put("messageType", messageType);
PageBeanNew<CultivateNotifyDTO> pageBeanNew= cultivateNotifySendDao.listPageNew(new PageParam(currentPage, numPerPage), map, "getNotifyListByType"); PageBeanNew<CultivateNotifyDTO> pageBeanNew = cultivateNotifySendDao.listPageNew(new PageParam(currentPage, numPerPage), map, "getNotifyListByType");
List<CultivateNotifyItem> cultivateNotifyItemList = new ArrayList<>(); 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> cultivateNotifyItems = new ArrayList<>();
List<CultivateNotifyItem> list1=cultivateNotifyItemDao.getNotifyItemsByMessageId(cultivateNotifyDTO.getMessageId()); List<CultivateNotifyItem> list1=cultivateNotifyItemDao.getNotifyItemsByMessageId(cultivateNotifyDTO.getMessageId());
List<CultivateNotifyItem> list2=cultivateNotifyItemDao.getNotifyItemsByMessageId4Jump(cultivateNotifyDTO.getMessageId()); List<CultivateNotifyItem> list2=cultivateNotifyItemDao.getNotifyItemsByMessageId4Jump(cultivateNotifyDTO.getMessageId());
...@@ -204,6 +208,22 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz { ...@@ -204,6 +208,22 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
return pageBeanNew; 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){ private void fillResource(List<CultivateNotifyItem> list){
List<Long> resourceIds=new ArrayList<>(); List<Long> resourceIds=new ArrayList<>();
for (CultivateNotifyItem notifyItem : list){ for (CultivateNotifyItem notifyItem : list){
...@@ -661,6 +681,8 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz { ...@@ -661,6 +681,8 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
cultivateNotify.setTitle(newSendDTO.getTitle()); cultivateNotify.setTitle(newSendDTO.getTitle());
cultivateNotify.setSendType(newSendDTO.getSendType()); cultivateNotify.setSendType(newSendDTO.getSendType());
cultivateNotify.setAgentId(0L); cultivateNotify.setAgentId(0L);
cultivateNotify.setCreateUserId(newSendDTO.getCreateUserId());
cultivateNotify.setCreateUserRole(newSendDTO.getCreateUserRole());
cultivateNotifyDao.insert(cultivateNotify); cultivateNotifyDao.insert(cultivateNotify);
CultivateNotifyItem cultivateNotifyItem = new CultivateNotifyItem(); CultivateNotifyItem cultivateNotifyItem = new CultivateNotifyItem();
cultivateNotifyItem.setMessageId(cultivateNotify.getMessageId()); cultivateNotifyItem.setMessageId(cultivateNotify.getMessageId());
...@@ -699,6 +721,8 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz { ...@@ -699,6 +721,8 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
} }
//填充资讯应用作品问题 //填充资讯应用作品问题
fillAppOrProduct4Notify(cultivateNotifyItemList); fillAppOrProduct4Notify(cultivateNotifyItemList);
//填充发送用户信息
fillUserInfo(pageBeanNew.getRecordList());
ThreadPoolUtils.OTHER_THREAD_POOL.execute(() -> { ThreadPoolUtils.OTHER_THREAD_POOL.execute(() -> {
//批量更新消息已读未读 //批量更新消息已读未读
if (null != pageBeanNew && !ListUtils.isEmpty(pageBeanNew.getRecordList())) { if (null != pageBeanNew && !ListUtils.isEmpty(pageBeanNew.getRecordList())) {
...@@ -719,6 +743,8 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz { ...@@ -719,6 +743,8 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
cultivateNotify.setTitle(newSendDTO.getTitle()); cultivateNotify.setTitle(newSendDTO.getTitle());
cultivateNotify.setSendType(newSendDTO.getSendType()); cultivateNotify.setSendType(newSendDTO.getSendType());
cultivateNotify.setAgentId(0L); cultivateNotify.setAgentId(0L);
cultivateNotify.setCreateUserId(newSendDTO.getCreateUserId());
cultivateNotify.setCreateUserRole(newSendDTO.getCreateUserRole());
cultivateNotifyDao.insert(cultivateNotify); cultivateNotifyDao.insert(cultivateNotify);
CultivateNotifyItem cultivateNotifyItem = new CultivateNotifyItem(); CultivateNotifyItem cultivateNotifyItem = new CultivateNotifyItem();
cultivateNotifyItem.setMessageId(cultivateNotify.getMessageId()); cultivateNotifyItem.setMessageId(cultivateNotify.getMessageId());
......
...@@ -2,6 +2,7 @@ package com.pcloud.book.cultivate.dto; ...@@ -2,6 +2,7 @@ package com.pcloud.book.cultivate.dto;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.book.cultivate.entity.CultivateNotifyItem; import com.pcloud.book.cultivate.entity.CultivateNotifyItem;
import com.pcloud.readercenter.wechat.entity.WechatUser;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -71,4 +72,15 @@ public class CultivateNotifyDTO { ...@@ -71,4 +72,15 @@ public class CultivateNotifyDTO {
@ApiModelProperty("首页推图") @ApiModelProperty("首页推图")
private String squareImg; 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 { ...@@ -30,4 +30,8 @@ public class CultivateNotify extends BaseEntity {
@ApiModelProperty("首页推图") @ApiModelProperty("首页推图")
private String squareImg; private String squareImg;
private Long createUserId;
private String createUserRole;
} }
...@@ -19,26 +19,26 @@ ...@@ -19,26 +19,26 @@
<insert id="insert" parameterType="com.pcloud.book.cultivate.entity.CultivateNotify" useGeneratedKeys="true" keyProperty="messageId"> <insert id="insert" parameterType="com.pcloud.book.cultivate.entity.CultivateNotify" useGeneratedKeys="true" keyProperty="messageId">
insert into cultivate_notify insert into cultivate_notify
( (message_type,
message_type,
title, title,
create_time, create_time,
update_time, update_time,
send_type, send_type,
agent_id, agent_id,
show_home, show_home,
square_img square_img,
) create_user_id,
values ( create_user_role)
#{messageType}, values (#{messageType},
#{title}, #{title},
NOW(), NOW(),
NOW(), NOW(),
#{sendType}, #{sendType},
#{agentId}, #{agentId},
#{showHome}, #{showHome},
#{squareImg} #{squareImg},
) #{createUserId},
#{createUserRole})
</insert> </insert>
<update id="update" parameterType="com.pcloud.book.cultivate.entity.CultivateNotify"> <update id="update" parameterType="com.pcloud.book.cultivate.entity.CultivateNotify">
......
...@@ -119,11 +119,17 @@ ...@@ -119,11 +119,17 @@
</select> </select>
<select id="getNotifyListByType" parameterType="map" resultType="com.pcloud.book.cultivate.dto.CultivateNotifyDTO"> <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 select a.message_id messageId,
where a.message_id=c.message_id a.title,
and c.wechat_user_id=#{wechatUserId} 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"> <if test="messageType != null">
and c.message_type=#{messageType} and c.message_type = #{messageType}
</if> </if>
order by c.create_time desc order by c.create_time desc
</select> </select>
......
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