Commit b2c07c37 by 朱亚洁

feat:[none]馆配书

parent 5f570906
...@@ -74,7 +74,8 @@ public interface AppletBooklistBiz { ...@@ -74,7 +74,8 @@ public interface AppletBooklistBiz {
* @param numPerPage * @param numPerPage
* @return * @return
*/ */
PageBeanNew<AppletBooklistDTO> listBooklist(Integer currentPage, Integer numPerPage, String name, Long classifyId, Long agentId); PageBeanNew<AppletBooklistDTO> listBooklist(Integer currentPage, Integer numPerPage, String name, Long classifyId, Long agentId,
Long firstClassify,Long secondClassify,Long gradeLabelId, Long subjectLabelId);
/** /**
* 书单添加图书 * 书单添加图书
...@@ -263,4 +264,21 @@ public interface AppletBooklistBiz { ...@@ -263,4 +264,21 @@ public interface AppletBooklistBiz {
* * @param null * * @param null
*/ */
PageBeanNew<AppletOuterBookDTO> listPageOuterBookByBooklistId(Integer currentPage, Integer numPerPage, Long booklistId); PageBeanNew<AppletOuterBookDTO> listPageOuterBookByBooklistId(Integer currentPage, Integer numPerPage, Long booklistId);
/**
* 根据书刊查询推荐书单列表
* @author:zhuyajie
* @date:2020/8/10 10:24
* * @param null
*/
List<AppletBooklistDTO> getRecommendBooklistByBook(Long bookId, Long adviserId, Long channelId);
/**
* 根据书刊分类自动创建书单
* @author:zhuyajie
* @date:2020/8/28 19:22
* * @param null
*/
void autoCreateBooklistByTemplet(Long firstClassify);
} }
package com.pcloud.book.applet.dao; package com.pcloud.book.applet.dao;
import com.pcloud.book.applet.dto.AppletBooklistDTO;
import com.pcloud.book.applet.dto.BookDTO4Booklist; import com.pcloud.book.applet.dto.BookDTO4Booklist;
import com.pcloud.book.applet.entity.AppletBooklist; import com.pcloud.book.applet.entity.AppletBooklist;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
...@@ -65,4 +66,15 @@ public interface AppletBooklistDao extends BaseDao<AppletBooklist> { ...@@ -65,4 +66,15 @@ public interface AppletBooklistDao extends BaseDao<AppletBooklist> {
* @return * @return
*/ */
BookDTO4Booklist getByBookIdAdviserChannel(Long adviserId, Long channelId, Long bookId); BookDTO4Booklist getByBookIdAdviserChannel(Long adviserId, Long channelId, Long bookId);
/**
* 根据分类查询书单
* @author:zhuyajie
* @date:2020/8/10 10:37
* * @param null
*/
List<AppletBooklistDTO> getByLabel(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, Integer limit);
} }
package com.pcloud.book.applet.dao.impl; package com.pcloud.book.applet.dao.impl;
import com.pcloud.book.applet.dao.AppletBooklistDao; import com.pcloud.book.applet.dao.AppletBooklistDao;
import com.pcloud.book.applet.dto.AppletBooklistDTO;
import com.pcloud.book.applet.dto.BookDTO4Booklist; import com.pcloud.book.applet.dto.BookDTO4Booklist;
import com.pcloud.book.applet.entity.AppletBooklist; import com.pcloud.book.applet.entity.AppletBooklist;
import com.pcloud.common.core.dao.BaseDaoImpl; import com.pcloud.common.core.dao.BaseDaoImpl;
...@@ -69,4 +70,16 @@ public class AppletBooklistDaoImpl extends BaseDaoImpl<AppletBooklist> implement ...@@ -69,4 +70,16 @@ public class AppletBooklistDaoImpl extends BaseDaoImpl<AppletBooklist> implement
map.put("bookId", bookId); map.put("bookId", bookId);
return getSessionTemplate().selectOne(getStatement("getByBookIdAdviserChannel"),map); return getSessionTemplate().selectOne(getStatement("getByBookIdAdviserChannel"),map);
} }
@Override
public List<AppletBooklistDTO> getByLabel(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, Integer limit) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("firstClassify", firstClassify);
paramMap.put("secondClassify", secondClassify);
paramMap.put("gradeLabelId", gradeLabelId);
paramMap.put("subjectLabelId", subjectLabelId);
paramMap.put("limit", limit);
return getSessionTemplate().selectList(getStatement("getByLabel"), paramMap);
}
} }
...@@ -46,4 +46,22 @@ public class AppletBooklistDTO extends BaseDto { ...@@ -46,4 +46,22 @@ public class AppletBooklistDTO extends BaseDto {
@ApiModelProperty("图书信息") @ApiModelProperty("图书信息")
private List<BookDTO4Booklist> bookDTO4Booklists; private List<BookDTO4Booklist> bookDTO4Booklists;
@ApiModelProperty("第一级类型标识")
private Long firstClassify;
@ApiModelProperty("第二级类型标识")
private Long secondClassify;
@ApiModelProperty("年级标签id")
private Long gradeLabelId;
@ApiModelProperty("科目标签id")
private Long subjectLabelId;
@ApiModelProperty("第一级类型")
private String firstClassifyContent;
@ApiModelProperty("第二级类型")
private String secondClassifyContent;
@ApiModelProperty("年级标签")
private String gradeLabelIdContent;
@ApiModelProperty("科目标签")
private String subjectLabelIdContent;
} }
...@@ -56,4 +56,6 @@ public class BookDTO4Booklist extends BaseDto { ...@@ -56,4 +56,6 @@ public class BookDTO4Booklist extends BaseDto {
private Integer classifyId; private Integer classifyId;
@ApiModelProperty("进群方式") @ApiModelProperty("进群方式")
private Integer joinGroupType; private Integer joinGroupType;
@ApiModelProperty("摘要")
private String remark;
} }
package com.pcloud.book.applet.entity; package com.pcloud.book.applet.entity;
import com.pcloud.common.entity.BaseEntity; import com.pcloud.book.rightsSetting.entity.BaseTempletClassify;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@Data @Data
@ApiModel("小程序书单") @ApiModel("小程序书单")
public class AppletBooklist extends BaseEntity { public class AppletBooklist extends BaseTempletClassify {
@ApiModelProperty("书单主题名称") @ApiModelProperty("书单主题名称")
private String booklistName; private String booklistName;
...@@ -32,4 +32,13 @@ public class AppletBooklist extends BaseEntity { ...@@ -32,4 +32,13 @@ public class AppletBooklist extends BaseEntity {
@ApiModelProperty("栏目id") @ApiModelProperty("栏目id")
private Long classifyId; private Long classifyId;
@ApiModelProperty("第一级类型标识")
private Long firstClassify;
@ApiModelProperty("第二级类型标识")
private Long secondClassify;
@ApiModelProperty("年级标签id")
private Long gradeLabelId;
@ApiModelProperty("科目标签id")
private Long subjectLabelId;
} }
...@@ -228,13 +228,19 @@ public class AppletHomeFacade { ...@@ -228,13 +228,19 @@ public class AppletHomeFacade {
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage, @RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页数量") Integer numPerPage, @RequestParam("numPerPage") @ApiParam("每页数量") Integer numPerPage,
@RequestParam(value = "name", required = false) @ApiParam("名称查询") String name, @RequestParam(value = "name", required = false) @ApiParam("名称查询") String name,
@RequestParam(value = "classifyId", required = false) @ApiParam("书单栏目id") Long classifyId) throws PermissionException { @RequestParam(value = "classifyId", required = false) @ApiParam("书单栏目id") Long classifyId,
Map<String, Object> map = SessionUtil.getToken4Redis(token); @RequestParam(value = "firstClassify", required = false) @ApiParam("一级书刊分类") Long firstClassify,
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID); @RequestParam(value = "secondClassify", required = false) @ApiParam("二级书刊分类")Long secondClassify,
@RequestParam(value = "gradeLabelId", required = false) @ApiParam("年级标签")Long gradeLabelId,
@RequestParam(value = "subjectLabelId", required = false) @ApiParam("科目标签")Long subjectLabelId
) throws PermissionException {
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
if (null==currentPage || null == numPerPage){ if (null==currentPage || null == numPerPage){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少分页参数"); throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少分页参数");
} }
return new ResponseDto<>(appletBooklistBiz.listBooklist(currentPage, numPerPage, name, classifyId, agentId)); return new ResponseDto<>(appletBooklistBiz.listBooklist(currentPage, numPerPage, name, classifyId, agentId, firstClassify,secondClassify,
gradeLabelId,subjectLabelId));
} }
@ApiOperation("书单添加图书") @ApiOperation("书单添加图书")
...@@ -1103,6 +1109,27 @@ public class AppletHomeFacade { ...@@ -1103,6 +1109,27 @@ public class AppletHomeFacade {
Long agentId = (Long) SessionUtil.getVlaue(token, SessionUtil.RAY_AGENT_ID); Long agentId = (Long) SessionUtil.getVlaue(token, SessionUtil.RAY_AGENT_ID);
return new ResponseDto<>(appletStatisticBiz.getStatisticByAgent(agentId)); return new ResponseDto<>(appletStatisticBiz.getStatisticByAgent(agentId));
} }
@ApiOperation("获取推荐书单")
@GetMapping("getRecommendBooklist")
public ResponseDto<?> getRecommendBooklist(
@RequestParam("bookId") Long bookId,
@RequestParam("adviserId") Long adviserId,
@RequestParam("channelId") Long channelId){
if (null == bookId || null == adviserId || null == channelId){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少参数");
}
return new ResponseDto<>(appletBooklistBiz.getRecommendBooklistByBook(bookId, adviserId, channelId));
}
@ApiOperation("根据书刊分类自动创建书单")
@GetMapping("autoCreateBooklistByTemplet")
public ResponseDto<?> autoCreateBooklistByTemplet(@RequestParam("firstClassify") Long firstClassify){
if (null != firstClassify){
appletBooklistBiz.autoCreateBooklistByTemplet(firstClassify);
}
return new ResponseDto<>();
}
} }
......
...@@ -109,4 +109,16 @@ public class AssistTempletConsr { ...@@ -109,4 +109,16 @@ public class AssistTempletConsr {
} }
return list; return list;
} }
@ParamLog("根据id查类型")
public AssistTempletDTO getTempletById(Long id){
AssistTempletDTO assistTempletDTO = null;
try {
assistTempletDTO = ResponseHandleUtil.parseResponse(assistTempletService.getById(id),AssistTempletDTO.class);
}catch (Exception e){
LOGGER.error("调用失败"+e.getMessage());
}
return assistTempletDTO;
}
} }
...@@ -13,21 +13,27 @@ ...@@ -13,21 +13,27 @@
<result column="classify_id" property="classifyId" jdbcType="BIGINT" /> <result column="classify_id" property="classifyId" jdbcType="BIGINT" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="first_classify" property="firstClassify" jdbcType="BIGINT" />
<result column="second_classify" property="secondClassify" jdbcType="BIGINT" />
<result column="grade_label_id" property="gradeLabelId" jdbcType="BIGINT" />
<result column="subject_label_id" property="subjectLabelId" jdbcType="BIGINT" />
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
id, booklist_name, user_name, digest, display_pic, introduce_type, introduce_content, introduce_url, id, booklist_name, user_name, digest, display_pic, introduce_type, introduce_content, introduce_url,
classify_id, create_time, update_time classify_id, create_time, update_time, first_classify, second_classify, grade_label_id, subject_label_id
</sql> </sql>
<insert id="insert" parameterType="com.pcloud.book.applet.entity.AppletBooklist" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" parameterType="com.pcloud.book.applet.entity.AppletBooklist" useGeneratedKeys="true" keyProperty="id">
insert into applet_booklist ( insert into applet_booklist (
booklist_name, user_name, digest, display_pic, introduce_type, introduce_content, introduce_url, booklist_name, user_name, digest, display_pic, introduce_type, introduce_content, introduce_url,
classify_id, create_time, update_time classify_id, create_time, update_time, first_classify, second_classify, grade_label_id, subject_label_id
) )
values ( values (
#{booklistName}, #{userName}, #{digest}, #{displayPic}, #{introduceType}, #{introduceContent}, #{introduceUrl}, #{booklistName}, #{userName}, #{digest}, #{displayPic}, #{introduceType}, #{introduceContent}, #{introduceUrl},
#{classifyId}, NOW(), NOW() #{classifyId}, NOW(), NOW(), #{firstClassify,jdbcType=BIGINT}, #{secondClassify,jdbcType=BIGINT},
#{gradeLabelId,jdbcType=BIGINT}, #{subjectLabelId,jdbcType=BIGINT}
) )
</insert> </insert>
...@@ -58,6 +64,10 @@ ...@@ -58,6 +64,10 @@
<if test="classifyId != null"> <if test="classifyId != null">
classify_id = #{classifyId}, classify_id = #{classifyId},
</if> </if>
first_classify = #{firstClassify,jdbcType=BIGINT},
second_classify = #{secondClassify,jdbcType=BIGINT},
grade_label_id = #{gradeLabelId,jdbcType=BIGINT},
subject_label_id = #{subjectLabelId,jdbcType=BIGINT},
update_time=NOW() update_time=NOW()
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
...@@ -95,7 +105,11 @@ ...@@ -95,7 +105,11 @@
b.display_pic displayPic, b.display_pic displayPic,
COUNT(c.id) bookCounts, COUNT(c.id) bookCounts,
a.id classifyId, a.id classifyId,
a.classify_name classifyName a.classify_name classifyName,
b.first_classify firstClassify,
b.second_classify secondClassify,
b.grade_label_id gradeLabelId,
b.subject_label_id subjectLabelId
FROM applet_booklist b FROM applet_booklist b
LEFT JOIN applet_booklist_config c ON b.id=c.booklist_id LEFT JOIN applet_booklist_config c ON b.id=c.booklist_id
LEFT JOIN applet_booklist_classify a ON b.classify_id=a.id LEFT JOIN applet_booklist_classify a ON b.classify_id=a.id
...@@ -106,6 +120,18 @@ ...@@ -106,6 +120,18 @@
<if test="classifyId >0"> <if test="classifyId >0">
AND b.classify_id= #{classifyId} AND b.classify_id= #{classifyId}
</if> </if>
<if test="firstClassify!=null">
AND b.first_classify =#{firstClassify}
</if>
<if test="secondClassify!=null">
AND b.second_classify =#{secondClassify}
</if>
<if test="gradeLabelId != null">
AND b.grade_label_id = #{gradeLabelId}
</if>
<if test="subjectLabelId != null">
AND b.subject_label_id = #{subjectLabelId}
</if>
<choose> <choose>
<when test="agentId != null"> <when test="agentId != null">
and a.agent_id = #{agentId} and a.agent_id = #{agentId}
...@@ -144,7 +170,8 @@ ...@@ -144,7 +170,8 @@
A.SECOND_TEMPLET_ID secondTempletId, A.SECOND_TEMPLET_ID secondTempletId,
c.seq seq, c.seq seq,
B.ISBN isbn, B.ISBN isbn,
CONCAT('BK',A.BOOK_ID) uniqueNumber CONCAT('BK',A.BOOK_ID) uniqueNumber,
B.REMARK remark
FROM FROM
applet_booklist_config c applet_booklist_config c
LEFT JOIN applet_booklist ap ON c.booklist_id=ap.id LEFT JOIN applet_booklist ap ON c.booklist_id=ap.id
...@@ -236,4 +263,41 @@ ...@@ -236,4 +263,41 @@
AND A.ADVISER_ID=#{adviserId} AND A.ADVISER_ID=#{adviserId}
AND A.CHANNEL_ID=#{channelId} AND A.CHANNEL_ID=#{channelId}
</select> </select>
<select id="getByLabel" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletBooklistDTO">
SELECT
b.id id,
b.booklist_name booklistName,
b.user_name userName,
b.display_pic displayPic,
COUNT(c.id) bookCounts
FROM
applet_booklist b
LEFT JOIN applet_booklist_config c ON b.id = c.booklist_id
WHERE 1 = 1
<if test="firstClassify!=null">
AND b.first_classify =#{firstClassify}
</if>
<if test="secondClassify!=null">
AND b.second_classify =#{secondClassify}
</if>
<if test="gradeLabelId != null">
AND b.grade_label_id = #{gradeLabelId}
</if>
<if test="subjectLabelId != null">
AND b.subject_label_id = #{subjectLabelId}
</if>
GROUP BY
b.id
HAVING
COUNT(c.id) > 0
ORDER BY b.create_time DESC
<if test="limit != null">
LIMIT #{limit}
</if>
</select>
</mapper> </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