Commit 24fee56a by 田超

Merge branch 'feature/1003871' into 'master'

feat:[1003871] 小程序站内信

See merge request rays/pcloud-book!1051
parents f1862198 783ae2a0
...@@ -22,5 +22,5 @@ public interface SearchRecordDao extends BaseDao<SearchRecord> { ...@@ -22,5 +22,5 @@ public interface SearchRecordDao extends BaseDao<SearchRecord> {
List<AdviserBookInfoDTO> getBookSearchIds(String keyword, Integer currentPage, Integer numPerPage); List<AdviserBookInfoDTO> getBookSearchIds(String keyword, Integer currentPage, Integer numPerPage);
List<Long> getWechatUserIds(Long bookId); List<Long> getWechatUserIds(List<Long> bookIds);
} }
...@@ -64,9 +64,9 @@ public class SearchRecordDaoImpl extends BaseDaoImpl<SearchRecord> implements Se ...@@ -64,9 +64,9 @@ public class SearchRecordDaoImpl extends BaseDaoImpl<SearchRecord> implements Se
} }
@Override @Override
public List<Long> getWechatUserIds(Long bookId) { public List<Long> getWechatUserIds(List<Long> bookIds) {
Map<String,Object> map=new HashMap<>(); Map<String,Object> map=new HashMap<>();
map.put("bookId",bookId); map.put("bookIds",bookIds);
return super.getSqlSession().selectList(super.getStatement("getWechatUserIds"),map); return super.getSqlSession().selectList(super.getStatement("getWechatUserIds"),map);
} }
} }
...@@ -5,6 +5,7 @@ import com.pcloud.book.applet.dto.SpecialBookDTO; ...@@ -5,6 +5,7 @@ import com.pcloud.book.applet.dto.SpecialBookDTO;
import com.pcloud.channelcenter.base.exceptions.ChannelBizException; import com.pcloud.channelcenter.base.exceptions.ChannelBizException;
import com.pcloud.readercenter.wechat.dto.NickNameAndOpenIdDto; import com.pcloud.readercenter.wechat.dto.NickNameAndOpenIdDto;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -271,6 +272,42 @@ public class ReaderConsr { ...@@ -271,6 +272,42 @@ public class ReaderConsr {
} }
return wechatUserIds; return wechatUserIds;
} }
public List<Long> getWechatUserIdsByUserProfile(String cityCode, String startTime, String endTime) {
LOGGER.info("根据名称或id获取用户id");
List<Long> wechatUserIds = new ArrayList<>();
try {
wechatUserIds = ResponseHandleUtil.parseList(wechatUserService.getWechatUserIdsByUserProfile(cityCode, startTime, endTime), Long.class);
} catch (Exception e) {
LOGGER.error("根据用户画像获取用户id.[getWechatUserByNameOrId]失败" + e.getMessage(), e);
}
return wechatUserIds;
}
public List<MiniUserDto> getSendUserInfo(List<Long> wechatUserIds) {
if(ListUtils.isEmpty(wechatUserIds)){
return new ArrayList<>();
}
List<MiniUserDto> result=new ArrayList<>();
try {
ResponseEntity<ResponseDto<List<MiniUserDto>>> sendUserRobotInfo = wechatUserService.getSendUserInfo(wechatUserIds);
result=ResponseHandleUtil.parseList(sendUserRobotInfo,MiniUserDto.class);
} catch (Exception e) {
LOGGER.error("获取小程序和小睿关系失败:" + e.getMessage(), e);
}
return result;
}
public List<Long> getMiniUsersByBookIds(List<Long> bookIds) {
LOGGER.info("根据名称或id获取用户id");
List<Long> wechatUserIds = new ArrayList<>();
try {
wechatUserIds = ResponseHandleUtil.parseList(wechatUserService.getMiniUsersByBookIds(bookIds), Long.class);
} catch (Exception e) {
LOGGER.error("根据用户画像获取用户id.[getWechatUserByNameOrId]失败" + e.getMessage(), e);
}
return wechatUserIds;
}
} }
package com.pcloud.book.cultivate.biz.impl; package com.pcloud.book.cultivate.biz.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.pcloud.appcenter.app.dto.AppDto;
import com.pcloud.book.applet.biz.AppletNewsBiz;
import com.pcloud.book.applet.dto.AppletBannerDTO;
import com.pcloud.book.applet.dto.AppletNewsDTO;
import com.pcloud.book.applet.dto.ServeItemInfoDTO;
import com.pcloud.book.applet.enums.AppletRecordTypeEnum;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.dao.BookDao; import com.pcloud.book.book.dao.BookDao;
import com.pcloud.book.book.dao.SearchRecordDao; import com.pcloud.book.book.dao.SearchRecordDao;
import com.pcloud.book.book.dto.AdviserBookInfoDTO; import com.pcloud.book.book.dto.AdviserBookInfoDTO;
import com.pcloud.book.consumer.app.AppConsr;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr; import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.content.ResourceConsr; import com.pcloud.book.consumer.content.ResourceConsr;
import com.pcloud.book.consumer.message.TemplateConsr; import com.pcloud.book.consumer.message.TemplateConsr;
import com.pcloud.book.consumer.reader.ReaderConsr; import com.pcloud.book.consumer.reader.ReaderConsr;
import com.pcloud.book.consumer.resource.ProductConsr;
import com.pcloud.book.consumer.user.AdviserConsr; import com.pcloud.book.consumer.user.AdviserConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr; import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.cultivate.biz.CultivateNotifyBiz; import com.pcloud.book.cultivate.biz.CultivateNotifyBiz;
...@@ -26,17 +36,22 @@ import com.pcloud.book.cultivate.entity.CultivateNotify; ...@@ -26,17 +36,22 @@ import com.pcloud.book.cultivate.entity.CultivateNotify;
import com.pcloud.book.cultivate.entity.CultivateNotifyItem; import com.pcloud.book.cultivate.entity.CultivateNotifyItem;
import com.pcloud.book.cultivate.entity.CultivateNotifySend; import com.pcloud.book.cultivate.entity.CultivateNotifySend;
import com.pcloud.book.cultivate.enums.NotifySendTypeEnum; import com.pcloud.book.cultivate.enums.NotifySendTypeEnum;
import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.util.common.ThreadPoolUtils; import com.pcloud.book.util.common.ThreadPoolUtils;
import com.pcloud.channelcenter.wechat.dto.AccountSettingDto;
import com.pcloud.common.core.dto.AppletTemplateMessageDto; import com.pcloud.common.core.dto.AppletTemplateMessageDto;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam; import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.DateUtils; import com.pcloud.common.utils.DateUtils;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.ServeLinkUtils;
import com.pcloud.contentcenter.resource.dto.ResourceDTO; import com.pcloud.contentcenter.resource.dto.ResourceDTO;
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.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;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -49,9 +64,12 @@ import java.util.HashMap; ...@@ -49,9 +64,12 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Component("cultivateNotifyBiz") @Component("cultivateNotifyBiz")
@Slf4j
public class CultivateNotifyBizImpl implements CultivateNotifyBiz { public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
@Autowired @Autowired
...@@ -81,6 +99,12 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz { ...@@ -81,6 +99,12 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
private QrcodeSceneConsr qrcodeSceneConsr; private QrcodeSceneConsr qrcodeSceneConsr;
private final Integer SEND_BATCH_NUM=100; private final Integer SEND_BATCH_NUM=100;
@Autowired
private AppletNewsBiz appletNewsBiz;
@Autowired
private AppConsr appConsr;
@Autowired
private ProductConsr productConsr;
@Override @Override
...@@ -109,6 +133,7 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz { ...@@ -109,6 +133,7 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
CultivateNotifyDTO notifyDTO= new CultivateNotifyDTO(); CultivateNotifyDTO notifyDTO= new CultivateNotifyDTO();
List<CultivateNotifyItem> list=cultivateNotifyItemDao.getNotifyItemsByMessageId(messageId); List<CultivateNotifyItem> list=cultivateNotifyItemDao.getNotifyItemsByMessageId(messageId);
fillResource(list); fillResource(list);
fillAppOrProduct4Notify(list);
notifyDTO.setCultivateNotifyItems(list); notifyDTO.setCultivateNotifyItems(list);
CultivateNotify byId = cultivateNotifyDao.getById(messageId); CultivateNotify byId = cultivateNotifyDao.getById(messageId);
notifyDTO.setMessageType(byId.getMessageType()); notifyDTO.setMessageType(byId.getMessageType());
...@@ -130,11 +155,12 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz { ...@@ -130,11 +155,12 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
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<>();
for (CultivateNotifyDTO cultivateNotifyDTO:pageBeanNew.getRecordList()) { for (CultivateNotifyDTO cultivateNotifyDTO:pageBeanNew.getRecordList()) {
List<CultivateNotifyItem> list1=cultivateNotifyItemDao.getNotifyItemsByMessageId(cultivateNotifyDTO.getMessageId()); List<CultivateNotifyItem> list1=cultivateNotifyItemDao.getNotifyItemsByMessageId(cultivateNotifyDTO.getMessageId());
fillResource(list1); fillResource(list1);
cultivateNotifyDTO.setCultivateNotifyItems(list1); cultivateNotifyDTO.setCultivateNotifyItems(list1);
cultivateNotifyItemList.addAll(list1);
} }
//批量更新消息已读未读 //批量更新消息已读未读
List<CultivateNotifySend> notifySends=cultivateNotifySendDao.getNotifySendsByType(wechatUserId,messageType); List<CultivateNotifySend> notifySends=cultivateNotifySendDao.getNotifySendsByType(wechatUserId,messageType);
...@@ -144,7 +170,8 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz { ...@@ -144,7 +170,8 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
notifySend.setUpdateTime(new Date()); notifySend.setUpdateTime(new Date());
cultivateNotifySendDao.update(notifySend); cultivateNotifySendDao.update(notifySend);
} }
//填充资讯应用作品
fillAppOrProduct4Notify(cultivateNotifyItemList);
return pageBeanNew; return pageBeanNew;
} }
...@@ -210,7 +237,7 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz { ...@@ -210,7 +237,7 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
} }
//书刊发送 //书刊发送
if(NotifySendTypeEnum.BOOK_USER.value.equals(cultivateNotifyDTO.getSendType())){ if(NotifySendTypeEnum.BOOK_USER.value.equals(cultivateNotifyDTO.getSendType())){
List<Long> wechatUserIds = searchRecordDao.getWechatUserIds(cultivateNotifyDTO.getBookId()); List<Long> wechatUserIds = readerConsr.getMiniUsersByBookIds(cultivateNotifyDTO.getBookIds());
if(ListUtils.isEmpty(wechatUserIds)){ if(ListUtils.isEmpty(wechatUserIds)){
return; return;
} }
...@@ -246,6 +273,34 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz { ...@@ -246,6 +273,34 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
readerMessageDto.setOfficialAccountsId(accountSettingId); readerMessageDto.setOfficialAccountsId(accountSettingId);
readerConsr.sendNotifyMiniUser(readerMessageDto); readerConsr.sendNotifyMiniUser(readerMessageDto);
} }
//用户画像发送
if (NotifySendTypeEnum.USER_PROFILE.value.equals(cultivateNotifyDTO.getSendType())) {
List<Long> wechatUserIds = readerConsr.getWechatUserIdsByUserProfile(cultivateNotifyDTO.getCityCode(), cultivateNotifyDTO.getStartTime(), cultivateNotifyDTO.getEndTime());
if(ListUtils.isEmpty(wechatUserIds)){
return;
}
for (int i = 0; i <= wechatUserIds.size() / SEND_BATCH_NUM; i++) {
int beginIndex = i * SEND_BATCH_NUM;
int endIndex = beginIndex + SEND_BATCH_NUM;
if (i == (wechatUserIds.size() - 1)/SEND_BATCH_NUM){
endIndex = wechatUserIds.size();
}
List<Long> subList = wechatUserIds.subList(beginIndex, endIndex);
List<CultivateNotifySend> cultivateNotifySendList=new ArrayList<>();
if(!ListUtils.isEmpty(subList)){
for (Long wechatUserId : subList) {
CultivateNotifySend cultivateNotifySend=new CultivateNotifySend();
cultivateNotifySend.setMessageId(cultivateNotify.getMessageId());
cultivateNotifySend.setMessageType(cultivateNotifyDTO.getMessageType());
cultivateNotifySend.setSendType(cultivateNotifyDTO.getSendType());
cultivateNotifySend.setWechatUserId(wechatUserId);
cultivateNotifySendList.add(cultivateNotifySend);
}
cultivateNotifySendDao.insert(cultivateNotifySendList);
sendAppletTemplateMessage(cultivateNotifySendList, cultivateNotify.getAgentId());
}
}
}
} }
/** /**
...@@ -302,6 +357,7 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz { ...@@ -302,6 +357,7 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
List<CultivateNotifyItem> cultivateNotifyItems = cultivateNotifyItemDao.getByMessageIds(messageIds); List<CultivateNotifyItem> cultivateNotifyItems = cultivateNotifyItemDao.getByMessageIds(messageIds);
itemMap= cultivateNotifyItems.stream().collect(Collectors.groupingBy(a -> a.getMessageId())); itemMap= cultivateNotifyItems.stream().collect(Collectors.groupingBy(a -> a.getMessageId()));
} }
List<CultivateNotifyItem> cultivateNotifyItems = new ArrayList<>();
for (CultivateNotifyPageDTO cultivateNotifyPageDTO : list) { for (CultivateNotifyPageDTO cultivateNotifyPageDTO : list) {
/* if(MapUtils.isNotEmpty(titleMap) && titleMap.containsKey(cultivateNotifyPageDTO.getMessageId())){ /* if(MapUtils.isNotEmpty(titleMap) && titleMap.containsKey(cultivateNotifyPageDTO.getMessageId())){
cultivateNotifyPageDTO.setTitle(titleMap.get(cultivateNotifyPageDTO.getMessageId())); cultivateNotifyPageDTO.setTitle(titleMap.get(cultivateNotifyPageDTO.getMessageId()));
...@@ -311,6 +367,104 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz { ...@@ -311,6 +367,104 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
} }
if(!ListUtils.isEmpty(cultivateNotifyPageDTO.getCultivateNotifyItems())){ if(!ListUtils.isEmpty(cultivateNotifyPageDTO.getCultivateNotifyItems())){
fillResource(cultivateNotifyPageDTO.getCultivateNotifyItems()); fillResource(cultivateNotifyPageDTO.getCultivateNotifyItems());
cultivateNotifyItems.addAll(cultivateNotifyPageDTO.getCultivateNotifyItems());
}
}
//填充资讯应用作品
fillAppOrProduct4Notify(cultivateNotifyItems);
}
private void fillAppOrProduct4Notify(List<CultivateNotifyItem> cultivateNotifyItems) {
if(ListUtils.isEmpty(cultivateNotifyItems)) {
return;
}
// 获取资讯信息
Map<Long, AppletNewsDTO> newsDTOMap = new HashMap<>();
CompletableFuture<List<Long>> newsBannerFuture = CompletableFuture.supplyAsync(() -> cultivateNotifyItems.stream()
.filter(x -> Objects.nonNull(x) && Objects.equals(x.getJumpType(), 3))
.map(CultivateNotifyItem::getServeId).filter(Objects::nonNull).distinct()
.collect(Collectors.toList())).whenComplete((list, throwable) -> {
if (Objects.nonNull(throwable)) {
log.error("[fillServeInfo] banner 图填充资讯信息失败,err:{}", throwable.getMessage(), throwable);
} else {
if (CollUtil.isEmpty(list)){
return;
}
Map<Long, AppletNewsDTO> dtoMap = appletNewsBiz.getByIds(list);
newsDTOMap.putAll(Objects.nonNull(dtoMap) ? dtoMap : new HashMap<>());
}
});
// 获取应用信息
Map<Long, AppDto> appDtoMap = new HashMap<>();
CompletableFuture<List<Long>> appBannerFuture = CompletableFuture.supplyAsync(() -> cultivateNotifyItems.stream()
.filter(x -> Objects.nonNull(x) && Objects.equals(x.getServeType(), AppletRecordTypeEnum.APP.value))
.map(CultivateNotifyItem::getServeId).collect(Collectors.toList())).whenComplete((list, throwable) -> {
if (Objects.nonNull(throwable)) {
log.error("[fillServeInfo] banner 图填充应用信息失败,err:{}", throwable.getMessage(), throwable);
} else {
Map<Long, AppDto> dtoMap = !ListUtils.isEmpty(list) ? appConsr.mapByIds4AuditPass(list) : new HashMap<>();
appDtoMap.putAll(dtoMap);
}
});
// 获取作品信息
Map<Long, ProductDto> productDtoMap = new HashMap<>();
CompletableFuture<List<Long>> productBannerFuture = CompletableFuture.supplyAsync(() -> cultivateNotifyItems.stream()
.filter(x -> Objects.nonNull(x) && Objects.equals(x.getServeType(), AppletRecordTypeEnum.PRODUCT.value))
.map(CultivateNotifyItem::getServeId).collect(Collectors.toList())).whenComplete((list, throwable) -> {
if (Objects.nonNull(throwable)) {
log.error("[fillServeInfo] banner 图填充作品信息失败,err:{}", throwable.getMessage(), throwable);
} else {
Map<Long, ProductDto> dtoMap = !ListUtils.isEmpty(list) ? productConsr.getProBasesByIds(list) : new HashMap<>();
productDtoMap.putAll(dtoMap);
}
});
try {
CompletableFuture.allOf(newsBannerFuture, appBannerFuture, productBannerFuture).get();
} catch (InterruptedException | ExecutionException e) {
log.error("[fillServeInfo] banner 填充信息失败,err:{}", e.getMessage(), e);
}
// 填充信息
for (CultivateNotifyItem banner : cultivateNotifyItems) {
if (Objects.nonNull(banner) && Objects.nonNull(banner.getServeId()) && Objects.nonNull(banner.getServeType())) {
Integer serveType = banner.getServeType();
if (Objects.equals(banner.getJumpType(), 3) && Objects.nonNull(newsDTOMap.get(banner.getServeId()))) {
banner.setNewsItem(newsDTOMap.get(banner.getServeId()));
} else if (Objects.equals(serveType, AppletRecordTypeEnum.APP.value) && Objects.nonNull(appDtoMap.get(banner.getServeId()))) {
AppDto appDto = appDtoMap.get(banner.getServeId());
String resultLinkUrl = null;
if (Objects.nonNull(appDto.getChannelId())) {
AccountSettingDto accountSettingDto = qrcodeSceneConsr.getWechatInfo(appDto.getChannelId());
// 根据 APP 拼接 linkUrl
String linkUrl = ServeLinkUtils.getServeLink("APP", appDto.getTypeCode(), appDto.getAppId().toString(),
appDto.getSceneCode(), appDto.getChannelId().toString(), appDto.getCreatedUser().toString(), null);
if (Objects.nonNull(accountSettingDto)) {
resultLinkUrl = SendWeixinRequestTools.splitUrl(accountSettingDto, linkUrl);
}
}
ServeItemInfoDTO build = ServeItemInfoDTO.builder().serveId(appDto.getAppId()).serveType(serveType)
.serveName(appDto.getTitle()).servePic(appDto.getSquareImg()).transverseImg(appDto.getTransverseImg())
.resultUrl(resultLinkUrl).hasThirdLink(StrUtil.isNotBlank(appDto.getTurnUrl()))
.serveTypeName(appDto.getTypeName()).build();
banner.setAppItem(build);
} else if (Objects.equals(serveType, AppletRecordTypeEnum.PRODUCT.value) && Objects.nonNull(productDtoMap.get(banner.getServeId()))) {
ProductDto productDto = productDtoMap.get(banner.getServeId());
String resultLinkUrl = null;
if (Objects.nonNull(productDto.getChannelId())) {
AccountSettingDto accountSettingDto = qrcodeSceneConsr.getWechatInfo(productDto.getChannelId());
if (null != accountSettingDto) {
resultLinkUrl = SendWeixinRequestTools.splitUrl(accountSettingDto, productDto.getTurnUrl());
}
}
ServeItemInfoDTO build = ServeItemInfoDTO.builder().serveId(productDto.getProductId()).serveType(serveType)
.serveName(productDto.getProductName()).servePic(productDto.getCoverImg()).transverseImg(productDto.getPicture1())
.resultUrl(resultLinkUrl).hasThirdLink(StrUtil.isNotBlank(productDto.getSkipUrl()))
.serveTypeName(productDto.getShortName()).build();
banner.setAppItem(build);
}
} }
} }
} }
...@@ -325,7 +479,7 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz { ...@@ -325,7 +479,7 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
return new PageBeanNew<>(searchSendUserDTO.getCurrentPage(), searchSendUserDTO.getNumPerPage(), new ArrayList<>()); return new PageBeanNew<>(searchSendUserDTO.getCurrentPage(), searchSendUserDTO.getNumPerPage(), new ArrayList<>());
} }
List<Long> sendUserIds = cultivateNotifySendDao.getSendUserIds(searchSendUserDTO.getMessageId(), searchSendUserDTO.getCurrentPage(), searchSendUserDTO.getNumPerPage()); List<Long> sendUserIds = cultivateNotifySendDao.getSendUserIds(searchSendUserDTO.getMessageId(), searchSendUserDTO.getCurrentPage(), searchSendUserDTO.getNumPerPage());
List<MiniUserDto> list = readerConsr.getSendUserRobotInfo(sendUserIds); List<MiniUserDto> list = readerConsr.getSendUserInfo(sendUserIds);
return new PageBeanNew<>(searchSendUserDTO.getCurrentPage(), searchSendUserDTO.getNumPerPage(),count,list); return new PageBeanNew<>(searchSendUserDTO.getCurrentPage(), searchSendUserDTO.getNumPerPage(),count,list);
} }
......
...@@ -40,7 +40,7 @@ public class NotifyParamCheck { ...@@ -40,7 +40,7 @@ public class NotifyParamCheck {
} }
} }
if(NotifySendTypeEnum.BOOK_USER.value.equals(cultivateNotifyDTO.getSendType())) { if(NotifySendTypeEnum.BOOK_USER.value.equals(cultivateNotifyDTO.getSendType())) {
if (null==cultivateNotifyDTO.getBookId()) { if (ListUtils.isEmpty(cultivateNotifyDTO.getBookIds())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "bookId缺失!"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "bookId缺失!");
} }
} }
......
...@@ -28,7 +28,10 @@ public class CultivateNotifyDTO { ...@@ -28,7 +28,10 @@ public class CultivateNotifyDTO {
@ApiModelProperty("bookId") @ApiModelProperty("bookId")
private Long bookId; private Long bookId;
@ApiModelProperty("发送类型(1-指定用户,2-分类用户,3-按书籍查询,4-全局公告消息)") @ApiModelProperty("bookIds")
private List<Long> bookIds;
@ApiModelProperty("发送类型(1-指定用户,2-分类用户,3-按书籍查询,4-全局公告消息 5- 用户画像)")
private Integer sendType; private Integer sendType;
@JsonFormat( @JsonFormat(
...@@ -45,4 +48,14 @@ public class CultivateNotifyDTO { ...@@ -45,4 +48,14 @@ public class CultivateNotifyDTO {
@ApiModelProperty("出版社id") @ApiModelProperty("出版社id")
private Long agentId; private Long agentId;
@ApiModelProperty("城市编码")
private String cityCode;
@ApiModelProperty("注册开始时间")
private String startTime;
@ApiModelProperty("注册结束时间")
private String endTime;
} }
...@@ -27,7 +27,7 @@ public class CultivateNotifyPageDTO { ...@@ -27,7 +27,7 @@ public class CultivateNotifyPageDTO {
private List<CultivateNotifyItem> cultivateNotifyItems; private List<CultivateNotifyItem> cultivateNotifyItems;
@ApiModelProperty("发送时间") @ApiModelProperty("发送时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date sendTime; private Date sendTime;
} }
...@@ -12,4 +12,6 @@ public class SearchSendUserDTO{ ...@@ -12,4 +12,6 @@ public class SearchSendUserDTO{
private Integer numPerPage; private Integer numPerPage;
private String keyword; private String keyword;
private Long agentId;
} }
package com.pcloud.book.cultivate.entity; package com.pcloud.book.cultivate.entity;
import com.pcloud.book.applet.dto.AppletBannerDTO;
import com.pcloud.book.applet.dto.AppletNewsDTO;
import com.pcloud.book.applet.dto.ServeItemInfoDTO;
import com.pcloud.common.entity.BaseEntity; import com.pcloud.common.entity.BaseEntity;
import com.pcloud.contentcenter.resource.dto.ResourceOfficeItemDTO; import com.pcloud.contentcenter.resource.dto.ResourceOfficeItemDTO;
import com.pcloud.contentcenter.resource.dto.ResourcePdfItemDTO; import com.pcloud.contentcenter.resource.dto.ResourcePdfItemDTO;
...@@ -18,7 +21,7 @@ public class CultivateNotifyItem extends BaseEntity { ...@@ -18,7 +21,7 @@ public class CultivateNotifyItem extends BaseEntity {
@ApiModelProperty("消息id") @ApiModelProperty("消息id")
private Long messageId; private Long messageId;
@ApiModelProperty("发送内容(1-文本,2-图片,3-音频)") @ApiModelProperty("发送内容(1-文本,2-图片,3-音频, 4-链接)")
private Integer contentType; private Integer contentType;
@ApiModelProperty("文字内容") @ApiModelProperty("文字内容")
...@@ -60,4 +63,29 @@ public class CultivateNotifyItem extends BaseEntity { ...@@ -60,4 +63,29 @@ public class CultivateNotifyItem extends BaseEntity {
@ApiModelProperty("音频时长") @ApiModelProperty("音频时长")
private BigDecimal duration; private BigDecimal duration;
@ApiModelProperty("站内信发送选择活动类型时的资源")
private AppletBannerDTO sendServe;
@ApiModelProperty("跳转类型 1指定页面, 2web页面, 3资讯, 4应用作品")
private Integer jumpType;
@ApiModelProperty("跳转地址")
private String jumpUrl;
@ApiModelProperty("作品/应用/咨询的ID")
private Long serveId;
@ApiModelProperty("作品5/应用6/咨询的类型1")
private Integer serveType;
@ApiModelProperty("咨询具体信息")
private AppletNewsDTO newsItem;
@ApiModelProperty("咨询具体信息")
private ServeItemInfoDTO appItem;
} }
...@@ -17,7 +17,11 @@ public enum NotifySendTypeEnum { ...@@ -17,7 +17,11 @@ public enum NotifySendTypeEnum {
/** /**
* 全局公告消息 * 全局公告消息
*/ */
ALL_USER(4); ALL_USER(4),
/**
*用户画像
*/
USER_PROFILE(5);
public final Integer value; public final Integer value;
......
...@@ -79,9 +79,9 @@ public class CultivateNotifyFacade { ...@@ -79,9 +79,9 @@ public class CultivateNotifyFacade {
@ApiOperation("首条未读消息详情") @ApiOperation("首条未读消息详情")
@GetMapping("/getFirstNoReadNotify") @GetMapping("/getFirstNoReadNotify")
public ResponseDto<?> getFirstNoReadNotify(@CookieValue(value = "userInfo" ,required = false) String userInfo){ public ResponseDto<?> getFirstNoReadNotify(@CookieValue(value = "userInfo", required = false) String userInfo) {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID); Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
if(!NumberUtil.isNumber(wechatUserId)){ if (!NumberUtil.isNumber(wechatUserId)) {
throw new BizException(BizException.PARAM_IS_NULL.getCode(), "wechatUserId 不能为空"); throw new BizException(BizException.PARAM_IS_NULL.getCode(), "wechatUserId 不能为空");
} }
return new ResponseDto<>(cultivateNotifyBiz.getFirstNoReadNotify(wechatUserId)); return new ResponseDto<>(cultivateNotifyBiz.getFirstNoReadNotify(wechatUserId));
......
...@@ -155,7 +155,11 @@ ...@@ -155,7 +155,11 @@
<select id="getWechatUserIds" parameterType="map" resultType="Long"> <select id="getWechatUserIds" parameterType="map" resultType="Long">
select distinct wechat_user_id select distinct wechat_user_id
from search_record from search_record
where book_id=#{bookId} where
book_id in
<foreach collection="bookIds" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
and wechat_user_id>0 and wechat_user_id>0
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -10,10 +10,18 @@ ...@@ -10,10 +10,18 @@
<result column="resource_id" property="resourceId" jdbcType="BIGINT" /> <result column="resource_id" property="resourceId" jdbcType="BIGINT" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="serve_id" jdbcType="BIGINT" property="serveId"/>
<result column="serve_type" jdbcType="TINYINT" property="serveType"/>
<result column="jump_type" jdbcType="INTEGER" property="jumpType"/>
<result column="jump_url" jdbcType="VARCHAR" property="jumpUrl"/>
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
id,message_id, content_type, content,pic_url,resource_id, create_time,update_time id,message_id, content_type, content,pic_url,resource_id, create_time,update_time,
jump_type,
jump_url,
serve_id,
serve_type
</sql> </sql>
<insert id="batchInsert" parameterType="com.pcloud.book.cultivate.entity.CultivateNotifyItem" useGeneratedKeys="true" keyProperty="id"> <insert id="batchInsert" parameterType="com.pcloud.book.cultivate.entity.CultivateNotifyItem" useGeneratedKeys="true" keyProperty="id">
...@@ -25,7 +33,11 @@ ...@@ -25,7 +33,11 @@
pic_url, pic_url,
resource_id, resource_id,
create_time, create_time,
update_time update_time,
jump_type,
jump_url,
serve_id,
serve_type
) )
values values
<foreach collection="list" item="item" index="index" separator=","> <foreach collection="list" item="item" index="index" separator=",">
...@@ -36,7 +48,11 @@ ...@@ -36,7 +48,11 @@
#{item.picUrl}, #{item.picUrl},
#{item.resourceId}, #{item.resourceId},
NOW(), NOW(),
NOW() NOW(),
#{item.jumpType},
#{item.jumpUrl},
#{item.serveId},
#{item.serveType}
) )
</foreach> </foreach>
</insert> </insert>
......
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