Commit 51ebfe46 by Administrator

Merge branch 'feature/1003592' into 'master'

feat: [1003592] 小程序弹窗

See merge request rays/pcloud-book!967
parents b9a09f70 28bd0ebe
......@@ -3,11 +3,13 @@ package com.pcloud.book.rightsSetting.biz;
import com.pcloud.book.applet.dto.AppletNewsDTO;
import com.pcloud.book.applet.entity.AppletUserBookcase;
import com.pcloud.book.rightsSetting.dto.FillRightsSettingAppletsDTO;
import com.pcloud.book.rightsSetting.dto.PopupResourceInfoDTO;
import com.pcloud.book.rightsSetting.dto.RightsSettingDto;
import com.pcloud.book.rightsSetting.dto.RightsSettingShowStateDTO;
import com.pcloud.book.rightsSetting.entity.BaseTempletClassify;
import com.pcloud.book.rightsSetting.entity.RightsItemGroup;
import com.pcloud.book.rightsSetting.entity.RightsNowPic;
import com.pcloud.book.rightsSetting.entity.RightsNowPopup;
import com.pcloud.book.rightsSetting.entity.RightsSetting;
import com.pcloud.book.rightsSetting.entity.RightsSettingClassify;
import com.pcloud.book.rightsSetting.entity.RightsSettingItem;
......@@ -161,4 +163,20 @@ public interface RightsSettingBiz {
void fillGroupActivityHead(List<GroupActivity4AppletDTO> groupActivity4AppletList);
void fillThirdGroupHeadList(GroupActivity4AppletDTO groupActivity4AppletDTO);
/**
* 要弹出的资源
* @author:zhuyajie
* @date:2020/9/15 17:51
* * @param null
*/
PopupResourceInfoDTO getPopupResourceInfoByBook(Long wechatUserId, Long bookId, Long channelId, Long adviserId, Long rightsSettingId, Integer readType);
/**
* 资源弹窗记录埋点
* @author:zhuyajie
* @date:2020/9/16 10:40
* * @param null
*/
void addPopupRecord(RightsNowPopup rightsNowPopup);
}
package com.pcloud.book.rightsSetting.constants;
import com.pcloud.common.constant.CacheConstant;
import com.pcloud.common.core.constant.ProductTypeConstant;
import com.pcloud.common.enums.AppTypeEnum;
......@@ -39,4 +40,15 @@ public class RightsSettingConstant {
ProductTypeConstant.THIRDPARTY};
public static final Integer MAX_ITEM_COUNT = 3;
/**
* 答案课程弹窗
*/
public static final String ANSWER_POPUP = CacheConstant.BOOK +"RIGHTS_SETTING:answer_popup";
/**
* 品牌方课程弹窗-线上网课
*/
public static final String COURSE_POPUP = CacheConstant.BOOK +"RIGHTS_SETTING:course_popup";
}
package com.pcloud.book.rightsSetting.dao;
import com.pcloud.book.rightsSetting.entity.RightsNowPopup;
import com.pcloud.common.core.dao.BaseDao;
/**
* 权益也弹出记录(RightsNowPopup)表数据库访问层
*
* @author makejava
* @since 2020-09-16 10:30:07
*/
public interface RightsNowPopupDao extends BaseDao<RightsNowPopup>{
/**
* 查看点击记录
* @author:zhuyajie
* @date:2020/9/16 11:03
* * @param null
*/
Integer getUserPopupClickCount(Long wechatUserId, Long bookId, Long channelId, Long adviserId, Integer popupType);
/**
* 查资源是否点击
* @author:zhuyajie
* @date:2020/9/17 14:33
* * @param null
*/
Integer getUserPopupClickCountByServe(RightsNowPopup rightsNowPopup);
}
\ No newline at end of file
package com.pcloud.book.rightsSetting.dao.impl;
import com.pcloud.book.rightsSetting.dao.RightsNowPopupDao;
import com.pcloud.book.rightsSetting.entity.RightsNowPopup;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/**
* @ClassName com.pcloud.book.rightsSetting.dao.impl.RightsNowPopupDaoImpl
* @Author zhuyajie
* @Description 弹窗
* @Date 2020/9/16 10:32
* @Version 1.0
**/
@Component
public class RightsNowPopupDaoImpl extends BaseDaoImpl<RightsNowPopup> implements RightsNowPopupDao {
@Override
public Integer getUserPopupClickCount(Long wechatUserId, Long bookId, Long channelId, Long adviserId, Integer popupType) {
Map<String, Object> map = new HashMap<>();
map.put("wechatUserId", wechatUserId);
map.put("bookId", bookId);
map.put("channelId", channelId);
map.put("adviserId", adviserId);
map.put("popupType", popupType);
return getSessionTemplate().selectOne(getStatement("getUserPopupClickCount"), map);
}
@Override
public Integer getUserPopupClickCountByServe(RightsNowPopup rightsNowPopup) {
return getSessionTemplate().selectOne(getStatement("getUserPopupClickCountByServe"), rightsNowPopup);
}
}
package com.pcloud.book.rightsSetting.dto;
import com.pcloud.book.rightsSetting.entity.RightsNowItem;
import com.pcloud.common.dto.BaseDto;
import java.util.List;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @ClassName com.pcloud.book.rightsSetting.dto.PopupResourceInfoDTO
* @Author zhuyajie
* @Description 弹出资源信息
* @Date 2020/9/15 17:52
* @Version 1.0
**/
@Data
public class PopupResourceInfoDTO extends BaseDto {
@ApiModelProperty("是否弹出")
private Boolean popupState;
@ApiModelProperty("弹出的资源信息")
private List<RightsNowItem> popupList;
@ApiModelProperty("弹出类型(1配套资料2线上网课服务)")
private Integer popupType;
}
package com.pcloud.book.rightsSetting.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.common.entity.BaseEntity;
import java.util.Date;
import java.io.Serializable;
import lombok.Data;
/**
* 权益也弹出记录(RightsNowPopup)实体类
*
* @author makejava
* @since 2020-09-16 10:30:07
*/
@Data
public class RightsNowPopup extends BaseEntity {
private static final long serialVersionUID = -29622792648706099L;
/**
* 用户id
*/
private Long wechatUserId;
/**
* 书刊id
*/
private Long bookId;
/**
* 渠道id
*/
private Long channelId;
/**
* 编辑id
*/
private Long adviserId;
/**
* 权益id
*/
private Long rightsSettingId;
/**
* 弹出类型(1配套资料2线上网课服务)
*/
private Integer popupType;
/**
* 资源id
*/
private Long serveId;
/**
* 资源类型APP/PRODUCT/NEWS
*/
private String serveType;
/**
* 记录类型(1弹出2点击领取3关闭)
*/
private Integer recordType;
/**
* 创建时间
*/
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
private Date createTime;
/**
* 修改时间
*/
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
private Date updateTime;
/**
* 阅读类型
*/
private Integer readType;
}
\ No newline at end of file
package com.pcloud.book.rightsSetting.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.common.entity.BaseEntity;
import com.pcloud.common.page.PageBeanNew;
import io.swagger.annotations.ApiModelProperty;
......@@ -11,7 +12,7 @@ import java.util.Date;
import java.util.List;
@Data
public class RightsSettingTitle implements Serializable {
public class RightsSettingTitle extends BaseEntity {
private Long id;
private Long rightsSettingId;
......
package com.pcloud.book.rightsSetting.enums;
public enum RightsNowPopupRecordType {
/**
* 1弹出
*/
POPUP(1),
/**
* 2点击领取
*/
RECEIVE(2),
/**
* 3关闭
*/
CLOSE(3);
public final Integer value;
RightsNowPopupRecordType(Integer value) {
this.value = value;
}
}
package com.pcloud.book.rightsSetting.enums;
public enum RightsNowPopupType {
/**
* 1 配套资料-答案
*/
SERVES_ANSWER(1),
/**
* 2线上网课
*/
ONLINE_COURSE(2);
public final Integer value;
RightsNowPopupType(Integer value) {
this.value = value;
}
}
......@@ -5,6 +5,7 @@ import com.pcloud.book.rightsSetting.biz.RightsSettingBiz;
import com.pcloud.book.rightsSetting.dto.RightsSettingDto;
import com.pcloud.book.rightsSetting.dto.RightsSettingShowStateDTO;
import com.pcloud.book.rightsSetting.entity.RightsNowPic;
import com.pcloud.book.rightsSetting.entity.RightsNowPopup;
import com.pcloud.book.rightsSetting.entity.RightsSetting;
import com.pcloud.book.rightsSetting.entity.RightsSettingClassify;
import com.pcloud.book.rightsSetting.entity.RightsSettingItem;
......@@ -326,4 +327,29 @@ public class RightsSettingFacede {
rightsSettingBiz.batchUpdateShowState(rightsSettingShowStateDTO);
return new ResponseDto<>();
}
@ApiOperation("要弹出的资源")
@GetMapping("getPopupResourceInfoByBook")
public ResponseDto<?> getPopupResourceInfoByBook(
@CookieValue("userInfo") String userInfo,
@RequestParam("bookId") Long bookId,
@RequestParam("channelId")Long channelId,
@RequestParam("adviserId")Long adviserId,
@RequestParam(value = "rightsSettingId", required = false)Long rightsSettingId,
@RequestParam(value = "readType", required = false) Integer readType){
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
return new ResponseDto<>(rightsSettingBiz.getPopupResourceInfoByBook(wechatUserId,bookId,channelId,adviserId,rightsSettingId,readType));
}
@ApiOperation("资源弹窗记录埋点")
@PostMapping("addPopupRecord")
public ResponseDto<?> addPopupRecord(@CookieValue("userInfo") String userInfo, @RequestBody @ApiParam RightsNowPopup rightsNowPopup){
if (null == rightsNowPopup){
throw new BookBizException(BookBizException.PARAM_IS_NULL, "缺少参数");
}
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
rightsNowPopup.setWechatUserId(wechatUserId);
rightsSettingBiz.addPopupRecord(rightsNowPopup);
return new ResponseDto<>();
}
}
\ No newline at end of file
<?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.pcloud.book.rightsSetting.dao.impl.RightsNowPopupDaoImpl">
<resultMap type="com.pcloud.book.rightsSetting.entity.RightsNowPopup" id="RightsNowPopupMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="wechatUserId" column="wechat_user_id" jdbcType="INTEGER"/>
<result property="bookId" column="book_id" jdbcType="INTEGER"/>
<result property="channelId" column="channel_id" jdbcType="INTEGER"/>
<result property="adviserId" column="adviser_id" jdbcType="INTEGER"/>
<result property="rightsSettingId" column="rights_setting_id" jdbcType="INTEGER"/>
<result property="popupType" column="popup_type" jdbcType="INTEGER"/>
<result property="serveId" column="serve_id" jdbcType="INTEGER"/>
<result property="serveType" column="serve_type" jdbcType="VARCHAR"/>
<result property="recordType" column="record_type" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="readType" column="read_type" jdbcType="INTEGER"/>
</resultMap>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into book.rights_now_popup(wechat_user_id, book_id, channel_id, adviser_id, rights_setting_id, popup_type, serve_id, serve_type, record_type, create_time, update_time, read_type)
values (#{wechatUserId}, #{bookId}, #{channelId}, #{adviserId}, #{rightsSettingId}, #{popupType}, #{serveId}, #{serveType}, #{recordType}, now(), now(), #{readType})
</insert>
<select id="getUserPopupClickCount" parameterType="map" resultType="integer">
SELECT COUNT(1) FROM book.rights_now_popup
WHERE wechat_user_id = #{wechatUserId}
and book_id = #{bookId}
and channel_id = #{channelId}
and adviser_id = #{adviserId}
and popup_type = #{popupType}
AND record_type IN (2, 3)
</select>
<select id="getUserPopupClickCountByServe" parameterType="com.pcloud.book.rightsSetting.entity.RightsNowPopup" resultType="integer">
SELECT COUNT(1) FROM book.rights_now_popup
WHERE wechat_user_id = #{wechatUserId}
and book_id = #{bookId}
and channel_id = #{channelId}
and adviser_id = #{adviserId}
and popup_type = #{popupType}
AND record_type IN (2, 3)
and serve_id = #{serveId}
and serve_type = #{serveType}
</select>
</mapper>
\ No newline at end of file
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