Commit c770a785 by 吴博

feat: [1005535] 书籍可控跳转

parent 27aaf7e2
......@@ -143,4 +143,9 @@ public class BookAdviserDto extends BaseDto {
* 是否开启书籍目录功能
*/
private Integer isOpenCatalog;
/**
* 是否跳转本书
*/
private Integer isJumpBook;
}
......@@ -849,6 +849,19 @@ public class BookDto extends BaseDto {
*/
private String label4;
/**
* 是否开启跳转本书服务
*/
private Integer isJumpBook;
public Integer getIsJumpBook() {
return isJumpBook;
}
public void setIsJumpBook(Integer isJumpBook) {
this.isJumpBook = isJumpBook;
}
public String getLabel1() {
return label1;
}
......
......@@ -452,4 +452,18 @@ public interface BookAdviserBiz {
* @return
*/
BookLabelAndClassifyVO getBookGradeLabel(Long bookId, Long adviserId, Long channelId);
/*
更新跳转本书服务状态
*/
void updateJumpBookState(Long bookId, Long adviserId, Long channelId, Integer isJumpBook);
/**
* 获取本书跳转状态
* @param bookId
* @param adviserId
* @param channelId
* @return
*/
Integer getJumpBookState(Long bookId, Long adviserId, Long channelId);
}
......@@ -3373,4 +3373,32 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
}
return null != bookLabelAndClassifyVO ? bookLabelAndClassifyVO : new BookLabelAndClassifyVO();
}
@Override
public void updateJumpBookState(Long bookId, Long adviserId, Long channelId, Integer isJumpBook) {
bookAdviserDao.updateJumpBookState(bookId, adviserId, channelId, isJumpBook);
String jumpBookKey = "BOOK:JUMP_BOOK";
String field = StrUtil.join("_",bookId, adviserId, channelId);
JedisClusterUtils.hset(jumpBookKey, field, isJumpBook.toString());
JedisClusterUtils.expire(jumpBookKey, 3600 * 24);
}
@Override
public Integer getJumpBookState(Long bookId, Long adviserId, Long channelId) {
String jumpBookKey = "BOOK:JUMP_BOOK";
String field = StrUtil.join("_",bookId, adviserId, channelId);
String jumpBookStateString = JedisClusterUtils.hget(jumpBookKey, field);
Integer jumpBookState = null;
if (StringUtil.isEmpty(jumpBookStateString)) {
BookAdviserDto base = bookAdviserDao.getBase(bookId, channelId, adviserId);
if (null != base && null != base.getIsJumpBook()) {
jumpBookState = base.getIsJumpBook();
JedisClusterUtils.hset(jumpBookKey, field, base.getIsJumpBook().toString());
JedisClusterUtils.expire(jumpBookKey, 3600 * 24);
}
} else {
jumpBookState = Integer.valueOf(jumpBookStateString);
}
return jumpBookState;
}
}
......@@ -341,4 +341,6 @@ public interface BookAdviserDao extends BaseDao<BookAdviser> {
Integer getBookWechatAuth(Long bookId, Long adviserId, Long channelId);
List<Long> getYesterdayUpdateBookIds(String startTime, String endTime);
void updateJumpBookState(Long bookId, Long adviserId, Long channelId, Integer isJumpBook);
}
......@@ -493,4 +493,14 @@ public class BookAdviserDaoImpl extends BaseDaoImpl<BookAdviser> implements Book
paramMap.put("endTime", endTime);
return getSessionTemplate().selectList(getStatement("getYesterdayUpdateBookIds"), paramMap);
}
@Override
public void updateJumpBookState(Long bookId, Long adviserId, Long channelId, Integer isJumpBook) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookId",bookId);
paramMap.put("channelId", channelId);
paramMap.put("adviserId", adviserId);
paramMap.put("isJumpBook", isJumpBook);
getSessionTemplate().update(getStatement("updateJumpBookState"), paramMap);
}
}
......@@ -507,4 +507,30 @@ public class BookAdviserFacadeImpl implements BookAdviserFacade {
@RequestParam(value = "channelId" ) Long channelId) throws PermissionException {
return new ResponseDto<BookLabelAndClassifyVO>(bookAdviserBiz.getBookGradeLabel(bookId, adviserId, channelId));
}
/**
* 更新是否跳转本书状态
*/
@RequestMapping(value = "updateJumpBookState", method = RequestMethod.GET)
public ResponseDto<?> updateJumpBookState(
@RequestHeader("token") String token,
@RequestParam(value = "bookId" ) Long bookId,
@RequestParam(value = "channelId" ) Long channelId,
@RequestParam(value = "isJumpBook" ) Integer isJumpBook) throws PermissionException {
Long adviserId = (Long)SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
bookAdviserBiz.updateJumpBookState(bookId, adviserId, channelId, isJumpBook);
return new ResponseDto<>();
}
/**
* 更新是否跳转本书状态
*/
@RequestMapping(value = "getJumpBookState", method = RequestMethod.GET)
public ResponseDto<?> getJumpBookState(
@RequestParam(value = "bookId" ) Long bookId,
@RequestParam(value = "channelId" ) Long channelId,
@RequestParam(value = "adviserId" ) Long adviserId) throws PermissionException {
return new ResponseDto<>( bookAdviserBiz.getJumpBookState(bookId, adviserId, channelId));
}
}
......@@ -77,6 +77,7 @@
<result column="is_relate" property="isRelate" jdbcType="BIT" />
<result column="book_phone_auth" property="bookPhoneAuth" jdbcType="BIT" />
<result column="is_wechat_auth" property="isWechatAuth" jdbcType="BIT" />
<result column="is_jump_book" property="isJumpBook" jdbcType="TINYINT" />
</resultMap>
<resultMap id="bookListPageMap" type="bookDto" extends ="bookMap">
......@@ -321,7 +322,7 @@
BA.GRA_LABEL_ID,BA.SUB_LABEL_ID,BA.VER_LABEL_ID,BA.AREA_LABEL_ID, BA.IS_PRINT isPrint, BA.is_relate,
BA.pro_label_id, BA.dep_label_id,BA.pur_label_id,BA.vol_label_id,if(G.ID IS NULL, 0, 1) isBookGroup, G.id BOOK_GROUP_ID,G.join_group_type,
BA.is_open_robot_process,BA.vol_label_id,b.unique_number,BA.CREATED_DATE,b.edition,BA.is_send_mini_url,
BA.is_open_catalog ,BA.is_approval, BA.book_phone_auth,BA.is_wechat_auth
BA.is_open_catalog ,BA.is_approval, BA.book_phone_auth,BA.is_wechat_auth,BA.is_jump_book
FROM
BOOK_ADVISER BA
INNER JOIN
......
......@@ -27,6 +27,7 @@
<result column="pro_label_id" property="proLabelId" jdbcType="BIGINT" />
<result column="pur_label_id" property="purLabelId" jdbcType="BIGINT" />
<result column="is_open_catalog" property="isOpenCatalog" jdbcType="BIT" />
<result column="is_jump_book" property="isJumpBook" jdbcType="TINYINT" />
</resultMap>
<resultMap id="manageAdviserMap" type="adviserManageDto" >
......@@ -125,7 +126,7 @@
BOOK_ADVISER_ID, BOOK_ID, TEMPLET_ID, CHANNEL_ID, ADVISER_ID, IS_DELETE,
TEMPLET_ID,SECOND_TEMPLET_ID,third_templet_id,
GRA_LABEL_ID,SUB_LABEL_ID,VER_LABEL_ID,AREA_LABEL_ID,is_open_robot_process,vol_label_id,
is_open_catalog, pur_label_id, dep_label_id, pro_label_id
is_open_catalog, pur_label_id, dep_label_id, pro_label_id, is_jump_book
FROM
BOOK_ADVISER
WHERE
......@@ -1313,4 +1314,19 @@
LAST_MODIFIED_DATE BETWEEN #{startTime} AND #{endTime}
</select>
<update id="updateJumpBookState" parameterType="map">
update
book_adviser
set
is_jump_book = #{isJumpBook}
where
BOOK_ID = #{bookId, jdbcType=BIGINT}
AND
ADVISER_ID = #{adviserId, jdbcType=BIGINT}
AND
CHANNEL_ID = #{channelId, jdbcType=BIGINT}
and
IS_DELETE = 0
</update>
</mapper>
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