Commit eb117ef7 by 朱亚洁

feat:[1004306]自有码+公众号流程优化

parent b47bcce0
......@@ -143,6 +143,30 @@ public class BookGroupDTO implements Serializable {
* 小睿码跳转类型(默认进小睿小程序)
*/
private Integer jumpType;
/**
* 关注公众号后小睿入口文案标题
*/
private String entranceTitle;
/**
* 关注公众号后小睿入口文案内容
*/
private String entranceContent;
public String getEntranceTitle() {
return entranceTitle;
}
public void setEntranceTitle(String entranceTitle) {
this.entranceTitle = entranceTitle;
}
public String getEntranceContent() {
return entranceContent;
}
public void setEntranceContent(String entranceContent) {
this.entranceContent = entranceContent;
}
public Integer getJumpType() {
return jumpType;
......@@ -400,6 +424,8 @@ public class BookGroupDTO implements Serializable {
", appletUrl='" + appletUrl + '\'' +
", appletId='" + appletId + '\'' +
", jumpType=" + jumpType +
", entranceTitle='" + entranceTitle + '\'' +
", entranceContent='" + entranceContent + '\'' +
'}';
}
}
\ No newline at end of file
......@@ -1401,6 +1401,15 @@ public class BookGroupBizImpl implements BookGroupBiz {
bookGroupDTO.setAppletUrl(byBookGroupId == null ? "" : byBookGroupId.getAppletUrl());
bookGroupDTO.setUrl(bookGroupDTO.getGroupQrcodeLink());
bookGroupDTO.setAppletId(byBookGroupId == null ? "" : byBookGroupId.getAppletId());
if (QrcodeJumpType.H5_OFFICIAL_ACCOUNTS.getCode().equals(bookGroupDTO.getJumpType())) {
//关注公众号后小睿入口默认文案
if (StringUtil.isEmpty(bookGroupDTO.getEntranceTitle())) {
bookGroupDTO.setEntranceTitle("领取「完整版」本书服务");
}
if (StringUtil.isEmpty(bookGroupDTO.getEntranceContent())) {
bookGroupDTO.setEntranceContent("我是书僮小睿,你的专属伴读助手,我将为你提供本书配套服务,定制本书阅读计划");
}
}
}
return bookGroupDTO;
}
......@@ -6234,59 +6243,21 @@ public class BookGroupBizImpl implements BookGroupBiz {
bookGroupSceneDTO.setSceneId(bookGroupDTO.getSceneId());
QrcodeSceneDto qrcodeSceneDto = qrcodeSceneConsr.getById(bookGroupDTO.getSceneId());
bookGroupSceneDTO.setQrcodeUrl(null == qrcodeSceneDto?null:qrcodeSceneDto.getQrcodeUrl());
//原流程保留
List<BookServeDTO> bookServeDTOS = getBookAndBookGroupServeIds(bookGroupDTO.getCreateUser(), bookGroupDTO.getBookId(), bookGroupDTO.getChannelId());
if (CollUtil.isEmpty(bookServeDTOS)) {
return bookGroupSceneDTO;
}
Map<String, Set<String>> collect = bookServeDTOS.stream().filter(Objects::nonNull).collect(
Collectors.groupingBy(BookServeDTO::getServeType,
Collectors.mapping(BookServeDTO::getFromType, Collectors.toSet()))
);
if (CollUtil.isEmpty(collect)){
return bookGroupSceneDTO;
}
if (CollUtil.isEmpty(collect.get("APP")) && CollUtil.isEmpty(collect.get("PRODUCT"))){
return bookGroupSceneDTO;
}
List<Integer> mpServices = mpServiceMappingMapper.selectMapping(collect.get("APP"),collect.get("PRODUCT"));
if (CollUtil.isEmpty(mpServices)){
mpServices = new ArrayList<>();
}
// 要求少于4个的时候要随机补成4个
fillMpServices(mpServices,0,6);
bookGroupSceneDTO.setMpServices(mpServices);
//新流程改编为返回书所配置的资源
List<BookGroupServe> serveList = bookGroupServeDao.getListByBookGroupId(bookGroupId);
if (ListUtils.isEmpty(serveList)) {
return bookGroupSceneDTO;
}
fillServeInfo(serveList);
for (BookGroupServe bookGroupServe : serveList) {
//1004306返回本书服务5个
List<BookServeDTO> bookServeDTOS = getBookAndBookGroupServeIdsFive(bookGroupDTO.getCreateUser(), bookGroupDTO.getBookId(), bookGroupDTO.getChannelId());
if (ListUtils.isEmpty(bookServeDTOS) || bookServeDTOS.size()<5) {
//权益中补充资源
List<BookServeDTO> serveDTOList = rightsSettingBiz.getRightsSettingAppProduct(bookGroupDTO.getBookId(), bookGroupDTO.getChannelId(), bookGroupDTO.getCreateUser(), 5-bookServeDTOS.size());
if (!ListUtils.isEmpty(serveDTOList)) {
bookServeDTOS.addAll(serveDTOList);
}
}
bookGroupSceneDTO.setBookServices(serveList);
//填充资源信息
fillBookServe4RightsSetting(bookServeDTOS);
bookGroupSceneDTO.setBookServeDTOS(bookServeDTOS);
return bookGroupSceneDTO;
}
/**
* 要求少于4个的时候要随机补成4个
*
* @param mpServices 待填充列表
* @param min 随即填充的最小值 包含
* @param max 随即填充的最大值 不包含
*/
private void fillMpServices(List<Integer> mpServices, int min, int max) {
while (mpServices.size() < 4) {
int randomInt = RandomUtil.randomInt(min, max);
if (!mpServices.contains(randomInt)) {
mpServices.add(randomInt);
}
}
}
@Override
public BackgroundGroupQrcodeDTO getBackgroundGroupQr(BackgroundGroupQrcodeDTO backgroundGroupQrcodeDTO) {
......@@ -6423,10 +6394,6 @@ public class BookGroupBizImpl implements BookGroupBiz {
if (AppAndProductTypeEnum.PRODUCT.value.equals(bookServeDTO.getServeType())) {
if (!MapUtils.isEmpty(productDtoMap) && null != productDtoMap.get(bookServeDTO.getServeId())) {
ProductDto productDto = productDtoMap.get(bookServeDTO.getServeId());
if (checkRayUrl(productDto.getSkipUrl()) && ProductTypeConstant.ARTICLE.equals(bookServeDTO.getFromType())) {
removeList.add(bookServeDTO);
continue;
}
bookServeDTO.setServeName(productDto.getProductName());
bookServeDTO.setCoverImg(productDto.getCoverImg());
bookServeDTO.setTransverseImg(productDto.getPicture1());
......@@ -6434,6 +6401,10 @@ public class BookGroupBizImpl implements BookGroupBiz {
bookServeDTO.setFromType(productDto.getProductTypeDto().getTypeCode());
bookServeDTO.setFromTypeName(productDto.getProductTypeDto().getTypeName());
}
if (checkRayUrl(productDto.getSkipUrl()) && ProductTypeConstant.ARTICLE.equals(bookServeDTO.getFromType())) {
removeList.add(bookServeDTO);
continue;
}
//获取channelId,/C1404/product/display/10234028?adviserId=1001587&proType=MEMBER&source_type=QRCODE
Long channelId = null;
String url = bookServeDTO.getUrl();
......
......@@ -345,6 +345,31 @@ public class BookGroupDTO extends BaseDto {
@ApiModelProperty("是否第一次完成了今日任务 1是第一次完成所有任务 0 未完成或不是第一次")
private Integer isFinshTask;
/**
* 关注公众号后小睿入口文案标题
*/
private String entranceTitle;
/**
* 关注公众号后小睿入口文案内容
*/
private String entranceContent;
public String getEntranceTitle() {
return entranceTitle;
}
public void setEntranceTitle(String entranceTitle) {
this.entranceTitle = entranceTitle;
}
public String getEntranceContent() {
return entranceContent;
}
public void setEntranceContent(String entranceContent) {
this.entranceContent = entranceContent;
}
public Integer getIsFinshTask() {
return isFinshTask;
}
......@@ -995,6 +1020,12 @@ public class BookGroupDTO extends BaseDto {
", userCount=" + userCount +
", jumpType=" + jumpType +
", jumpUrl='" + jumpUrl + '\'' +
", backgroundType=" + backgroundType +
", groupQrcodeStyle=" + groupQrcodeStyle +
", originUrl='" + originUrl + '\'' +
", isFinshTask=" + isFinshTask +
", entranceTitle='" + entranceTitle + '\'' +
", entranceContent='" + entranceContent + '\'' +
", openWeapp=" + openWeapp +
", adviserId=" + adviserId +
", adviserPhone='" + adviserPhone + '\'' +
......
......@@ -38,4 +38,6 @@ public class BookGroupSceneDTO extends BaseDto {
private List<Integer> mpServices;
@ApiModelProperty("公众号配置的资源")
private List<BookGroupServe> bookServices;
@ApiModelProperty("本书服务资源")
private List<BookServeDTO> bookServeDTOS;
}
......@@ -223,6 +223,30 @@ public class BookGroup extends BaseEntity {
* 微信选择颜色生成的原始码地址
*/
private String originUrl;
/**
* 关注公众号后小睿入口文案标题
*/
private String entranceTitle;
/**
* 关注公众号后小睿入口文案内容
*/
private String entranceContent;
public String getEntranceTitle() {
return entranceTitle;
}
public void setEntranceTitle(String entranceTitle) {
this.entranceTitle = entranceTitle;
}
public String getEntranceContent() {
return entranceContent;
}
public void setEntranceContent(String entranceContent) {
this.entranceContent = entranceContent;
}
public String getOriginUrl() {
return originUrl;
......@@ -569,6 +593,11 @@ public class BookGroup extends BaseEntity {
", groupQrcodeLink='" + groupQrcodeLink + '\'' +
", jumpType=" + jumpType +
", jumpUrl='" + jumpUrl + '\'' +
", backgroundType=" + backgroundType +
", groupQrcodeStyle=" + groupQrcodeStyle +
", originUrl='" + originUrl + '\'' +
", entranceTitle='" + entranceTitle + '\'' +
", entranceContent='" + entranceContent + '\'' +
'}';
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.pcloud.book.rightsSetting.biz;
import com.pcloud.book.applet.dto.AppletNewsDTO;
import com.pcloud.book.applet.entity.AppletUserBookcase;
import com.pcloud.book.group.dto.BookServeDTO;
import com.pcloud.book.rightsSetting.dto.FillRightsSettingAppletsDTO;
import com.pcloud.book.rightsSetting.dto.PopupResourceInfoDTO;
import com.pcloud.book.rightsSetting.dto.ResourceList4Answer;
......@@ -248,4 +249,12 @@ public interface RightsSettingBiz {
* * @param null
*/
void handleRightsSettingOld(List<Long> rightsSettingIdList);
/**
* 书刊相应权益配置的应用和作品
* @author:zhuyajie
* @date:2021/2/19 17:42
* * @param null
*/
List<BookServeDTO> getRightsSettingAppProduct(Long bookId, Long channelId, Long adviserId, Integer limit);
}
......@@ -4394,4 +4394,16 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
rightsNowItemDao.batchInsert(nowItemList);
}
}
@Override
public List<BookServeDTO> getRightsSettingAppProduct(Long bookId, Long channelId, Long adviserId, Integer limit) {
RightsSettingDto rightsSettingDto = this.getRightsSettingByBookId4AppletHome(bookId, adviserId, channelId);
if (null == rightsSettingDto || null == rightsSettingDto.getId()) {
return new ArrayList<>();
}
List<String> serveTypes = Arrays.asList(AppAndProductTypeEnum.APP.value, AppAndProductTypeEnum.PRODUCT.value);
List<BookServeDTO> list = rightsNowItemDao.getServeItemsByServeTypes(rightsSettingDto.getId(), serveTypes,limit);
return list;
}
}
package com.pcloud.book.rightsSetting.dao;
import com.pcloud.book.book.vo.BookResourceNumDTO;
import com.pcloud.book.group.dto.BookServeDTO;
import com.pcloud.book.rightsSetting.entity.RightsNowItem;
import com.pcloud.common.core.dao.BaseDao;
......@@ -75,4 +76,12 @@ public interface RightsNowItemDao extends BaseDao<RightsNowItem> {
void deletePackageIds(List<Long> packageIds);
List<BookResourceNumDTO> listResourceNum4AdviserBook(List<Long> adviserIds, List<Long> channelIds, List<Long> bookIds);
/**
* 根据类型查权益配置的资源
* @author:zhuyajie
* @date:2021/2/19 17:50
* * @param null
*/
List<BookServeDTO> getServeItemsByServeTypes(Long id, List<String> serveTypes, Integer limit);
}
......@@ -2,6 +2,7 @@ package com.pcloud.book.rightsSetting.dao.impl;
import cn.hutool.core.map.MapUtil;
import com.pcloud.book.book.vo.BookResourceNumDTO;
import com.pcloud.book.group.dto.BookServeDTO;
import com.pcloud.book.rightsSetting.dao.RightsNowItemDao;
import com.pcloud.book.rightsSetting.entity.RightsNowItem;
import com.pcloud.common.core.dao.BaseDaoImpl;
......@@ -122,4 +123,13 @@ public class RightsNowItemDaoImpl extends BaseDaoImpl<RightsNowItem> implements
return getSessionTemplate().selectList(getStatement("listResourceNum4AdviserBook"), param);
}
@Override
public List<BookServeDTO> getServeItemsByServeTypes(Long rightsSettingId, List<String> serveTypes, Integer limit) {
Map<String, Object> map = new HashMap<>();
map.put("rightsSettingId", rightsSettingId);
map.put("serveTypes", serveTypes);
map.put("limit", limit);
return getSessionTemplate().selectList(getStatement("getServeItemsByServeTypes"), map);
}
}
......@@ -40,6 +40,8 @@
<result column="origin_url" property="originUrl" jdbcType="VARCHAR" />
<result column="jump_type" property="jumpType" jdbcType="INTEGER"/>
<result column="jump_url" property="jumpUrl" jdbcType="VARCHAR"/>
<result column="entrance_title" property="entranceTitle" jdbcType="VARCHAR"/>
<result column="entrance_content" property="entranceContent" jdbcType="VARCHAR"/>
</resultMap>
<resultMap id="BookGroupDTO" type="com.pcloud.book.group.dto.BookGroupDTO">
......@@ -86,6 +88,8 @@
<result column="origin_url" property="originUrl" jdbcType="VARCHAR" />
<result column="jump_type" property="jumpType" jdbcType="INTEGER"/>
<result column="jump_url" property="jumpUrl" jdbcType="VARCHAR"/>
<result column="entrance_title" property="entranceTitle" jdbcType="VARCHAR"/>
<result column="entrance_content" property="entranceContent" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
......@@ -95,7 +99,7 @@
update_time, is_delete, is_show_book_name,join_group_type,add_friend_guide,customer_service_name,
is_invite_group,book_group_cipher, last_push_update_time, is_some_update, agent_id, belong_special_agent,
short_book_name, open_weapp, single_group, related_book_group_id,group_qrcode_page_num,group_qrcode_location_id,group_qrcode_remark,
group_qrcode_link,back_ground_type, jump_type, jump_url,origin_url
group_qrcode_link,back_ground_type, jump_type, jump_url,origin_url, entrance_title, entrance_content
</sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
......@@ -399,6 +403,12 @@
<if test="originUrl != null">
origin_url = #{originUrl},
</if>
<if test="entranceTitle != null">
entrance_title = #{entranceTitle},
</if>
<if test="entranceContent != null">
entrance_content = #{entranceContent},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
......
......@@ -339,4 +339,23 @@
</foreach>
group by adviserId, bookId, channelId
</select>
<select id="getServeItemsByServeTypes" parameterType="map" resultType="com.pcloud.book.group.dto.BookServeDTO">
SELECT
serve_id serveId,
serve_type serveType,
link_url url
FROM
rights_now_item
WHERE
rights_setting_id = #{rightsSettingId}
AND serve_type IN
<foreach collection="serveTypes" open="(" close=")" item="item" index="index" separator=",">
#{item}
</foreach>
<if test="limit > 0">
LIMIT #{limit}
</if>
</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