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> {
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
}
@Override
public List<Long> getWechatUserIds(Long bookId) {
public List<Long> getWechatUserIds(List<Long> bookIds) {
Map<String,Object> map=new HashMap<>();
map.put("bookId",bookId);
map.put("bookIds",bookIds);
return super.getSqlSession().selectList(super.getStatement("getWechatUserIds"),map);
}
}
......@@ -5,6 +5,7 @@ import com.pcloud.book.applet.dto.SpecialBookDTO;
import com.pcloud.channelcenter.base.exceptions.ChannelBizException;
import com.pcloud.readercenter.wechat.dto.NickNameAndOpenIdDto;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -271,6 +272,42 @@ public class ReaderConsr {
}
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;
}
}
......@@ -40,7 +40,7 @@ public class NotifyParamCheck {
}
}
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缺失!");
}
}
......
......@@ -28,7 +28,10 @@ public class CultivateNotifyDTO {
@ApiModelProperty("bookId")
private Long bookId;
@ApiModelProperty("发送类型(1-指定用户,2-分类用户,3-按书籍查询,4-全局公告消息)")
@ApiModelProperty("bookIds")
private List<Long> bookIds;
@ApiModelProperty("发送类型(1-指定用户,2-分类用户,3-按书籍查询,4-全局公告消息 5- 用户画像)")
private Integer sendType;
@JsonFormat(
......@@ -45,4 +48,14 @@ public class CultivateNotifyDTO {
@ApiModelProperty("出版社id")
private Long agentId;
@ApiModelProperty("城市编码")
private String cityCode;
@ApiModelProperty("注册开始时间")
private String startTime;
@ApiModelProperty("注册结束时间")
private String endTime;
}
......@@ -27,7 +27,7 @@ public class CultivateNotifyPageDTO {
private List<CultivateNotifyItem> cultivateNotifyItems;
@ApiModelProperty("发送时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date sendTime;
}
......@@ -12,4 +12,6 @@ public class SearchSendUserDTO{
private Integer numPerPage;
private String keyword;
private Long agentId;
}
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.contentcenter.resource.dto.ResourceOfficeItemDTO;
import com.pcloud.contentcenter.resource.dto.ResourcePdfItemDTO;
......@@ -18,7 +21,7 @@ public class CultivateNotifyItem extends BaseEntity {
@ApiModelProperty("消息id")
private Long messageId;
@ApiModelProperty("发送内容(1-文本,2-图片,3-音频)")
@ApiModelProperty("发送内容(1-文本,2-图片,3-音频, 4-链接)")
private Integer contentType;
@ApiModelProperty("文字内容")
......@@ -60,4 +63,29 @@ public class CultivateNotifyItem extends BaseEntity {
@ApiModelProperty("音频时长")
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 {
/**
* 全局公告消息
*/
ALL_USER(4);
ALL_USER(4),
/**
*用户画像
*/
USER_PROFILE(5);
public final Integer value;
......
......@@ -79,9 +79,9 @@ public class CultivateNotifyFacade {
@ApiOperation("首条未读消息详情")
@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);
if(!NumberUtil.isNumber(wechatUserId)){
if (!NumberUtil.isNumber(wechatUserId)) {
throw new BizException(BizException.PARAM_IS_NULL.getCode(), "wechatUserId 不能为空");
}
return new ResponseDto<>(cultivateNotifyBiz.getFirstNoReadNotify(wechatUserId));
......
......@@ -155,7 +155,11 @@
<select id="getWechatUserIds" parameterType="map" resultType="Long">
select distinct wechat_user_id
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
</select>
</mapper>
\ No newline at end of file
......@@ -10,10 +10,18 @@
<result column="resource_id" property="resourceId" jdbcType="BIGINT" />
<result column="create_time" property="createTime" 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>
<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>
<insert id="batchInsert" parameterType="com.pcloud.book.cultivate.entity.CultivateNotifyItem" useGeneratedKeys="true" keyProperty="id">
......@@ -25,7 +33,11 @@
pic_url,
resource_id,
create_time,
update_time
update_time,
jump_type,
jump_url,
serve_id,
serve_type
)
values
<foreach collection="list" item="item" index="index" separator=",">
......@@ -36,7 +48,11 @@
#{item.picUrl},
#{item.resourceId},
NOW(),
NOW()
NOW(),
#{item.jumpType},
#{item.jumpUrl},
#{item.serveId},
#{item.serveType}
)
</foreach>
</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