Commit 70ce8361 by 吴博

1002825 小程序配置读书计划

parent 8e45e3a6
......@@ -428,6 +428,11 @@ public class BookBizImpl implements BookBiz {
BookDto bookDto = bookCache.getBookToRedis(bookId);
if (null == bookDto) {
bookDto = bookDao.getBaseById(bookId);
BookAdviserDto bookAdviserDto = bookAdviserBiz.getOneMainBook(bookId);
if (null != bookDto && null != bookAdviserDto){
bookDto.setTempletId(bookAdviserDto.getTempletId());
bookSet.setFirstTemplateName(bookDto);
}
// 将数据存入redis
bookCache.setBookToRedis(bookDto);
}
......
......@@ -1742,4 +1742,25 @@ public class BookSet {
}
}
public void setFirstTemplateName(BookDto bookDto) {
LOGGER.info("设置一级模板名称【START】");
if (bookDto == null || bookDto.getTempletId() == null) {
return;
}
List<Long> templetIds = new ArrayList<>();
if (Objects.nonNull(bookDto.getTempletId())) {
templetIds.add(bookDto.getTempletId());
}
Map<Long, AssistTempletDTO> assistTempletMap = assistTempletConsr.mapByIds4Classify(templetIds);
if (MapUtils.isEmpty(assistTempletMap)) {
return;
}
if (Objects.nonNull(bookDto.getTempletId())) {
setBookDtoTempletInfo(assistTempletMap, bookDto, bookDto.getTempletId());
}
LOGGER.info("设置模板名称【END】");
}
}
......@@ -50,4 +50,6 @@ public interface CustomPlanBiz {
UserBookServiceVO getUserBookServiceById(Long userBookServiceId);
List<PlanReadTypeDto> getPlanReadTypesByBookId(Long bookId);
List<CustomPlan> listByCustomPlanIds(List<Long> customPlanIds);
}
......@@ -536,4 +536,10 @@ public class CustomPlanBizImpl implements CustomPlanBiz {
List<PlanReadTypeDto> list=customPlanMapper.getPlanReadTypesByBookId(bookId);
return list;
}
@Override
@ParamLog(value = "批量获取定制服务",isAfterReturn = false)
public List<CustomPlan> listByCustomPlanIds(List<Long> customPlanIds) {
return customPlanMapper.getCustomPlanByIds(customPlanIds);
}
}
......@@ -39,4 +39,6 @@ public interface CustomPlanMapper {
CustomPlan getLastCustomPlan(@Param("bookIds") List<Long> bookIds,@Param("readType") Integer readType);
CustomPlan getLastCustomPlanByBookIds(@Param("bookIds") List<Long> bookIds);
List<CustomPlan> getCustomPlanByIds(@Param("customPlanIds") List<Long> customPlanIds);
}
\ No newline at end of file
package com.pcloud.book.rightsSetting.dao;
import com.pcloud.book.rightsSetting.entity.RightsCustomRelation;
import com.pcloud.book.rightsSetting.entity.RightsReadPlan;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/**
* @Description
* @Author zengpo
* @Date 2020/4/27 17:44
**/
public interface RightsCustomRelationDao extends BaseDao<RightsCustomRelation> {
List<RightsCustomRelation> getCustomByItemIds(List<Long> itemIdList);
}
package com.pcloud.book.rightsSetting.dao;
import com.pcloud.book.rightsSetting.entity.RightsReadPlan;
import com.pcloud.common.core.dao.BaseDao;
/**
* @Description
* @Author zengpo
* @Date 2020/4/27 17:44
**/
public interface RightsReadPlanDao extends BaseDao<RightsReadPlan> {
}
......@@ -39,4 +39,7 @@ public interface RightsSettingItemDao extends BaseDao<RightsSettingItem>{
*/
List<RightsSettingClassify>getAllRightsClassify(String rightsType);
List<RightsSettingItem> getItemByRightsIdAndType(Long rightsSettingId, String rightsType);
List<RightsSettingItem> getItemsByRightsSettingId4Read(Long rightsSettingId, String rightsType);
}
\ No newline at end of file
package com.pcloud.book.rightsSetting.dao.impl;
import com.pcloud.book.rightsSetting.dao.RightsCustomRelationDao;
import com.pcloud.book.rightsSetting.dao.RightsReadPlanDao;
import com.pcloud.book.rightsSetting.entity.RightsCustomRelation;
import com.pcloud.book.rightsSetting.entity.RightsReadPlan;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @Description
* @Author zengpo
* @Date 2020/4/27 17:44
**/
@Component("rightsCustomRelationDao")
public class RightsCustomRelationDaoImpl extends BaseDaoImpl<RightsCustomRelation> implements RightsCustomRelationDao {
@Override
public List<RightsCustomRelation> getCustomByItemIds(List<Long> itemIdList) {
return getSqlSession().selectList(getStatement("getCustomByItemIds"),itemIdList);
}
}
package com.pcloud.book.rightsSetting.dao.impl;
import com.pcloud.book.rightsSetting.dao.RightsReadPlanDao;
import com.pcloud.book.rightsSetting.entity.RightsReadPlan;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
/**
* @Description
* @Author zengpo
* @Date 2020/4/27 17:44
**/
@Component("rightsReadPlanDao")
public class RightsReadPlanDaoImpl extends BaseDaoImpl<RightsReadPlan> implements RightsReadPlanDao {
}
......@@ -38,4 +38,20 @@ public class RightsSettingItemDaoImpl extends BaseDaoImpl<RightsSettingItem> imp
map.put("rightsType",rightsType);
return getSessionTemplate().selectList(getStatement("getAllRightsClassify"), map);
}
@Override
public List<RightsSettingItem> getItemByRightsIdAndType(Long rightsSettingId, String rightsType) {
Map<String,Object> map = new HashMap<>();
map.put("rightsSettingId",rightsSettingId);
map.put("rightsType",rightsType);
return getSessionTemplate().selectList(getStatement("getItemByRightsIdAndType"), map);
}
@Override
public List<RightsSettingItem> getItemsByRightsSettingId4Read(Long rightsSettingId, String rightsType) {
Map<String,Object> map = new HashMap<>();
map.put("rightsSettingId",rightsSettingId);
map.put("rightsType",rightsType);
return getSessionTemplate().selectList(getStatement("getItemsByRightsSettingId4Read"), map);
}
}
package com.pcloud.book.rightsSetting.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Description
* @Author zengpo
* @Date 2020/4/27 17:41
**/
@Data
public class RightsCustomRelation extends BaseEntity {
@ApiModelProperty("定制服务方案id")
private Long customPlanId;
@ApiModelProperty("权益内容id")
private Long rightsSettingItemId;
}
package com.pcloud.book.rightsSetting.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Description
* @Author zengpo
* @Date 2020/4/27 17:41
**/
@Data
public class RightsReadPlan extends BaseEntity {
@ApiModelProperty("主键")
private Long id;
@ApiModelProperty("权益内容id")
private Long rightsSettingItemId;
@ApiModelProperty("本书阅读计划开关 0关闭 1开启")
private Integer isOpen;
@ApiModelProperty("服务说明")
private String serviceDesc;
}
......@@ -2,12 +2,14 @@ package com.pcloud.book.rightsSetting.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.book.applet.dto.AppletNewsDTO;
import com.pcloud.book.custom.entity.CustomPlan;
import com.pcloud.common.entity.BaseEntity;
import java.util.Date;
import java.io.Serializable;
import java.util.List;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
......@@ -54,4 +56,17 @@ public class RightsSettingItem extends BaseEntity {
* 资讯
*/
private List<AppletNewsDTO> appletNewsDTOS;
@ApiModelProperty("本书阅读计划开关 0关闭 1开启")
private Integer isOpen;
@ApiModelProperty("服务说明")
private String serviceDesc;
@ApiModelProperty("定制服务方案集合")
private List<CustomPlan> customPlanList;
@ApiModelProperty("唯一键")
private String uuid;
}
\ No newline at end of file
......@@ -27,11 +27,13 @@ public enum RightsNowItemType {
/**
* 6 配套资料
*/
SERVES(6);
SERVES(6),
/**
*
* 7线上学习/阅读提醒
*/
ONLINE_REMIND(7);
public final Integer value;
RightsNowItemType(Integer value) {
......
......@@ -261,4 +261,14 @@
ORDER BY id DESC
LIMIT 1
</select>
<select id="getCustomPlanByIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from custom_plan
where id IN
<foreach collection="customPlanIds" item="item" separator="," open="(" close=")">
${item}
</foreach>
ORDER BY id DESC
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.rightsSetting.dao.impl.RightsCustomRelationDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.rightsSetting.entity.RightsCustomRelation">
<result property="rightsSettingItemId" column="rights_setting_item_id" jdbcType="BIGINT"/>
<result property="customPlanId" column="custom_plan_id" jdbcType="BIGINT"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
rights_setting_item_id, custom_plan_id, create_time, update_time
</sql>
<!--批量新增-->
<insert id="batchInsert" useGeneratedKeys="true" parameterType="java.util.List">
insert into book.rights_custom_relation (
rights_setting_item_id, custom_plan_id, create_time, update_time
)
values
<foreach collection="list" item="item" index="index" separator="," >
(
#{item.rightsSettingItemId},
#{item.customPlanId},
NOW(),
NOW()
)
</foreach>
</insert>
<select id="getCustomByItemIds" parameterType="java.util.List" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> from rights_custom_relation where 1=1 and
rights_setting_item_id IN
<foreach collection="list" item="item" separator="," open="(" close=")">
${item}
</foreach>
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.rightsSetting.dao.impl.RightsReadPlanDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.rightsSetting.entity.RightsReadPlan">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="rightsSettingItemId" column="rights_setting_item_id" jdbcType="BIGINT"/>
<result property="isOpen" column="is_open" jdbcType="INTEGER"/>
<result property="serviceDesc" column="service_desc" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, rights_setting_item_id, is_open, service_desc, create_time, update_time
</sql>
<!--批量新增-->
<insert id="batchInsert" useGeneratedKeys="true" parameterType="java.util.List">
insert into book.rights_read_plan (
rights_setting_item_id, is_open, service_desc, create_time, update_time
)
values
<foreach collection="list" item="item" index="index" separator="," >
(
#{item.rightsSettingItemId},
#{item.isOpen},
#{item.serviceDesc},
NOW(),
NOW()
)
</foreach>
</insert>
</mapper>
\ No newline at end of file
......@@ -10,6 +10,7 @@
<result property="description" column="description" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="title" column="title" jdbcType="VARCHAR"/>
<result property="uuid" column="uuid" jdbcType="VARCHAR"/>
</resultMap>
<!--通过实体作为筛选条件查询-->
......@@ -17,8 +18,9 @@
select
i.id, i.rights_setting_id rightsSettingId,
i.rights_type rightsType, i.rights_classify_id rightsClassifyId,
i.description, i.create_time createTime, i.title
i.description, i.create_time createTime, i.title,i.uuid,IFNULL(p.is_open,0) isOpen,p.service_desc serviceDesc
from book.rights_setting_item i
left join book.rights_read_plan p on i.id=p.rights_setting_item_id
<where>
<if test="id != null">
and i.id = #{id}
......@@ -38,8 +40,8 @@
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into book.rights_setting_item(rights_setting_id, rights_type, rights_classify_id, description, create_time,title)
values (#{rightsSettingId}, #{rightsType}, #{rightsClassifyId}, #{description}, NOW(), #{title})
insert into book.rights_setting_item(rights_setting_id, rights_type, rights_classify_id, description, create_time,title,uuid)
values (#{rightsSettingId}, #{rightsType}, #{rightsClassifyId}, #{description}, NOW(), #{title},#{uuid})
</insert>
<!--通过权益主键删除-->
......@@ -54,7 +56,7 @@
<!--批量新增-->
<insert id="batchInsert" useGeneratedKeys="true" parameterType="java.util.List">
insert into book.rights_setting_item (
rights_setting_id, rights_type, rights_classify_id, description, create_time,title
rights_setting_id, rights_type, rights_classify_id, description, create_time,title,uuid
)
values
<foreach collection="list" item="item" index="index" separator="," >
......@@ -64,7 +66,8 @@
#{item.rightsClassifyId,jdbcType=VARCHAR},
#{item.description,jdbcType=VARCHAR},
NOW(),
#{item.title}
#{item.title},
#{item.uuid}
)
</foreach>
</insert>
......@@ -78,4 +81,22 @@
</if>
</select>
<select id="getItemsByRightsSettingId4Read" parameterType="map" resultType="com.pcloud.book.rightsSetting.entity.RightsSettingItem">
select
i.id, i.rights_setting_id rightsSettingId,
i.rights_type rightsType, i.rights_classify_id rightsClassifyId,
i.description, i.create_time createTime, i.title,i.uuid,IFNULL(p.is_open,0) isOpen,p.service_desc serviceDesc
from book.rights_setting_item i
left join book.rights_read_plan p on i.id=p.rights_setting_item_id
<where>
<if test="rightsSettingId != null">
and i.rights_setting_id = #{rightsSettingId}
</if>
<if test="rightsType != null and rightsType != ''">
and i.rights_type = #{rightsType}
</if>
</where>
order by i.id asc
</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