Commit 14228d98 by 吴博

feat: [1003769] 去掉三种阅读方式

parent 04652aad
......@@ -351,7 +351,7 @@ public class BookConstant {
public static final String DEFAULT_COVER_PIC="https://oss.5rs.me/oss/uploadfe/jpg/b10f42694d17429fe9ebd8dfd85704e0.jpg";
public static final Integer MAX_NEWS_COUNT = 3;
public static final Integer MAX_NEWS_COUNT = 4;
public static final Integer MAX_NEWS_COUNT_GROUP = 5;
......
......@@ -38,6 +38,7 @@ import com.pcloud.book.rightsSetting.dto.RightsSettingDto;
import com.pcloud.book.rightsSetting.entity.RightsNowItem;
import com.pcloud.book.rightsSetting.entity.RightsReadType;
import com.pcloud.book.rightsSetting.entity.RightsSetting;
import com.pcloud.book.rightsSetting.enums.RightsNowItemTypeNew;
import com.pcloud.book.rightsSetting.enums.RightsServeTypeEnum;
import com.pcloud.book.util.common.ThreadPoolUtils;
import com.pcloud.channelcenter.base.exceptions.ChannelBizException;
......@@ -648,6 +649,15 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
appletNewsServe.setServeType(AppletNewsServeTypeEnum.APPLET.code);
appletUserBookcaseDTO.setGuideAppletServe(appletNewsServe);
}else if ((RightsServeTypeEnum.PRODUCT.name().equalsIgnoreCase(rightsSetting.getGuideType()) ||
RightsServeTypeEnum.APP.name().equalsIgnoreCase(rightsSetting.getGuideType())) &&
rightsSetting.getGuideId()!=null ) {
RightsNowItem rightsNowItem = new RightsNowItem();
rightsNowItem.setServeId(rightsSetting.getGuideId());
rightsNowItem.setServeType(rightsSetting.getGuideType());
rightsNowItem.setType(RightsNowItemTypeNew.ONLINE_COURSE.value);
rightsSettingBiz.fillProductAndApp(Lists.newArrayList(rightsNowItem));
appletUserBookcaseDTO.setGuideAppItem(rightsNowItem);
}
}
......
......@@ -106,4 +106,7 @@ public class AppletUserBookcaseDTO extends BaseDto {
@ApiModelProperty("小程序对象")
private AppletNewsServeDTO guideAppletServe;
@ApiModelProperty("应用或作品对象")
private RightsNowItem guideAppItem;
}
......@@ -189,4 +189,10 @@ public interface RightsSettingBiz {
* * @param null
*/
ResourceList4Answer getResourceListByBook4Answer(Long wechatUserId, Long bookId, Long channelId, Long adviserId, Long sceneId);
/**
* 填充应用作品
* @param nowItems
*/
void fillProductAndApp(List<RightsNowItem> nowItems);
}
......@@ -109,6 +109,7 @@ import com.pcloud.common.utils.NumberUtil;
import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.common.utils.string.StringUtilParent;
import com.pcloud.readercenter.common.enums.YesOrNoNumEnum;
import com.pcloud.resourcecenter.product.dto.ProductDto;
import org.apache.commons.collections.CollectionUtils;
......@@ -233,20 +234,15 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
public Long addRightsSetting(RightsSetting rightsSetting) {
rightsSettingCheck.rightsSettingCheck4Insert(rightsSetting);
setClassifyAndLabel(rightsSetting);
setGuide(rightsSetting);
if (existCheck(rightsSetting) > 0) {
throw new BookBizException(BookBizException.ERROR, "已存在相同的权益设置");
}
this.setReadGuide(rightsSetting);
rightsSettingDAO.insert(rightsSetting);
Long rightsSettingId = rightsSetting.getId();
if (null == rightsSettingId) {
throw new BookBizException(BookBizException.DB_DML_FAIL, "新增权益设置失败");
}
List<RightsReadType> rightsReadTypes = rightsSetting.getRightsReadTypes();
if (!ListUtils.isEmpty(rightsReadTypes)) {
rightsReadTypes.forEach(e -> e.setRightsSettingId(rightsSettingId));
rightsReadTypeMapper.batchInsert(rightsReadTypes);
}
//新增关联书刊
List<RightsSettingBookRelation> rightsSettingBookRelations = rightsSetting.getRightsSettingBookRelations();
if (ListUtils.isEmpty(rightsSettingBookRelations)) {
......@@ -257,22 +253,6 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
return rightsSetting.getId();
}
private void setReadGuide(RightsSetting rightsSetting){
if (RightsServeTypeEnum.NEWS.name().equalsIgnoreCase(rightsSetting.getGuideType())){
if (rightsSetting.getGuideNewsItem()!=null){
rightsSetting.setGuideId(rightsSetting.getGuideNewsItem().getId());
}else {
rightsSetting.setGuideId(null);
}
}else if (AppAndProductTypeEnum.APPLET.name().equalsIgnoreCase(rightsSetting.getGuideType())){
if (rightsSetting.getGuideAppletServe()!=null){
rightsSetting.setGuideId(rightsSetting.getGuideAppletServe().getId());
}else {
rightsSetting.setGuideId(null);
}
}
}
@Override
public void setClassifyAndLabel(BaseTempletClassify baseTempletClassify) {
log.info("对于某些特殊分类做处理");
......@@ -421,19 +401,21 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
if (existCheck(rightsSetting) > 0) {
throw new BookBizException(BookBizException.ERROR, "已存在相同的权益设置");
}
this.setReadGuide(rightsSetting);
//设置读书引导
setGuide(rightsSetting);
rightsSettingDAO.updateByPrimaryKey(rightsSetting);
//更新阅读方式
rightsReadTypeMapper.deleteByRightsSettingId(rightsSettingId);
List<RightsReadType> rightsReadTypes = rightsSetting.getRightsReadTypes();
if (!ListUtils.isEmpty(rightsReadTypes)) {
rightsReadTypes.forEach(e -> e.setRightsSettingId(rightsSettingId));
rightsReadTypeMapper.batchInsert(rightsReadTypes);
}
//更新关联书刊
updateRelationBook(rightsSetting, rightsSettingId);
}
private void setGuide(RightsSetting rightsSetting) {
if(null != rightsSetting && (RightsServeTypeEnum.APP.name().equals(rightsSetting.getGuideType()) ||
RightsServeTypeEnum.PRODUCT.name().equals(rightsSetting.getGuideType())) && null != rightsSetting.getGuideAppItem()){
rightsSetting.setGuideLinkUrl(rightsSetting.getGuideAppItem().getLinkUrl());
}
}
private void updateRightsLongTerm(RightsSetting rightsSetting) {
// 设置uuid,批量更新使用
setRightsSettingItemUuid(rightsSetting);
......@@ -812,13 +794,13 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
}
private void fillReadGuide(RightsSetting rightsSetting){
RightsNowItem rightsNowItem = new RightsNowItem();
if (RightsServeTypeEnum.NEWS.name().equalsIgnoreCase(rightsSetting.getGuideType()) && rightsSetting.getGuideId()!=null){
Long newsId = rightsSetting.getGuideId();
AppletNewsDTO appletNewsDTO = appletNewsBiz.getNewsById(newsId);
RightsNowItem rightsNowItem = new RightsNowItem();
BeanUtils.copyProperties(appletNewsDTO,rightsNowItem);
rightsNowItem.setNewsSource(appletNewsDTO.getSource());
......@@ -854,6 +836,15 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
appletNewsServe.setServeType(AppletNewsServeTypeEnum.APPLET.code);
rightsSetting.setGuideAppletServe(appletNewsServe);
} else if ((RightsServeTypeEnum.PRODUCT.name().equalsIgnoreCase(rightsSetting.getGuideType()) ||
RightsServeTypeEnum.APP.name().equalsIgnoreCase(rightsSetting.getGuideType())) &&
rightsSetting.getGuideId()!=null ) {
rightsNowItem.setServeId(rightsSetting.getGuideId());
rightsNowItem.setServeType(rightsSetting.getGuideType());
rightsNowItem.setType(RightsNowItemTypeNew.ONLINE_COURSE.value);
rightsNowItem.setLinkUrl(rightsSetting.getGuideLinkUrl());
fillProductAndApp(Lists.newArrayList(rightsNowItem));
rightsSetting.setGuideAppItem(rightsNowItem);
}
}
......@@ -1330,7 +1321,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
}
}
// 首页才会拼 此处只有资讯才会补充资讯
boolean hasPage = Objects.isNull(currentPage) || (Objects.equals(currentPage, 0) && Objects.equals(numPerPage, 3));
boolean hasPage = Objects.isNull(currentPage) || (Objects.equals(currentPage, 0) && Objects.equals(numPerPage, 4));
if (hasPage && RightsServeTypeEnum.NEWS.name().equalsIgnoreCase(rightsSettingTitle.getServeType())) {
if (items.size() < top && rightsSettingTitle.getCollageState() != null && rightsSettingTitle.getCollageState().intValue() == collage.intValue()) {
// 填充咨询
......@@ -1433,7 +1424,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
}
private void fillProductAndApp(List<RightsNowItem> nowItems) {
@Override
public void fillProductAndApp(List<RightsNowItem> nowItems) {
log.info("即享权益填充产品和app内容");
if (ListUtils.isEmpty(nowItems)) {
return;
......
......@@ -152,7 +152,11 @@ public class RightsSetting extends BaseTempletClassify {
private Long agentId;
@ApiModelProperty("应用或作品对象")
private RightsNowItem guideAppItem;
@ApiModelProperty("应用或作品跳转地址")
private String guideLinkUrl;
public RightsSetting() {
......
......@@ -16,7 +16,13 @@ public enum RightsServeTypeEnum {
/**
* 外部书单
*/
BOOKLIST(4);
BOOKLIST(4),
//作品
PRODUCT(5),
//应用
APP(6);
public final Integer value;
......
......@@ -29,6 +29,7 @@
<result column="ver_label_id" property="verLabelId" jdbcType="BIGINT" />
<result column="show_state" property="showState" jdbcType="BOOLEAN"/>
<result column="agent_id" property="agentId" jdbcType="BIGINT" />
<result column="guide_link_url" property="guideLinkUrl" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="DtoResultMap" type="com.pcloud.book.rightsSetting.dto.RightsSettingDto">
......@@ -66,7 +67,7 @@
id,rights_number, introduce, detail, count, first_classify, second_classify, grade_label_id, subject_label_id,
create_time, update_time, enable_group_service, rights_setting_type, book_id
,online_course_open,learning_tool_open,draw_open,read_type_title, vol_label_id,
reading_guide,guide_title,guide_type,guide_id,guide_pic,ver_label_id, show_state, agent_id
reading_guide,guide_title,guide_type,guide_id,guide_pic,ver_label_id, show_state, agent_id, guide_link_url
</sql>
<sql id="Base_Column_List_own" >
......@@ -97,13 +98,13 @@
grade_label_id, subject_label_id, create_time,
update_time, enable_group_service, rights_setting_type, book_id,
online_course_open,learning_tool_open,draw_open,read_type_title, vol_label_id,
reading_guide,guide_title,guide_type,guide_id,guide_pic,ver_label_id, agent_id)
reading_guide,guide_title,guide_type,guide_id,guide_pic,ver_label_id, agent_id, guide_link_url)
values ( #{rightsNumber,jdbcType=VARCHAR}, #{introduce,jdbcType=VARCHAR}, #{detail,jdbcType=VARCHAR},
#{count,jdbcType=INTEGER}, #{firstClassify,jdbcType=BIGINT}, #{secondClassify,jdbcType=BIGINT},
#{gradeLabelId,jdbcType=BIGINT}, #{subjectLabelId,jdbcType=BIGINT}, now(),
#{updateTime,jdbcType=TIMESTAMP}, #{enableGroupService}, #{rightsSettingType}, #{bookId},
#{onlineCourseOpen},#{learningToolOpen},#{drawNowOpen},#{readTypeTitle}, #{volLabelId},
#{guideIsOpen},#{guideTitle},#{guideType},#{guideId},#{guidePic}, #{verLabelId}, #{agentId})
#{guideIsOpen},#{guideTitle},#{guideType},#{guideId},#{guidePic}, #{verLabelId}, #{agentId}, #{guideLinkUrl})
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.rightsSetting.entity.RightsSetting" >
update rights_setting
......@@ -211,7 +212,8 @@
guide_type = #{guideType,jdbcType=VARCHAR},
guide_id = #{guideId,jdbcType=BIGINT},
guide_pic = #{guidePic,jdbcType=VARCHAR},
ver_label_id = #{verLabelId,jdbcType=BIGINT}
ver_label_id = #{verLabelId,jdbcType=BIGINT},
guide_link_url = #{guideLinkUrl}
where id = #{id,jdbcType=BIGINT}
</update>
......
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