Commit 32bc291e by 吴博

feat: [1003395] 书刊权益批量上下架

parent 6d5e5386
...@@ -4,6 +4,7 @@ import com.pcloud.book.applet.dto.AppletNewsDTO; ...@@ -4,6 +4,7 @@ import com.pcloud.book.applet.dto.AppletNewsDTO;
import com.pcloud.book.applet.entity.AppletUserBookcase; import com.pcloud.book.applet.entity.AppletUserBookcase;
import com.pcloud.book.rightsSetting.dto.FillRightsSettingAppletsDTO; import com.pcloud.book.rightsSetting.dto.FillRightsSettingAppletsDTO;
import com.pcloud.book.rightsSetting.dto.RightsSettingDto; import com.pcloud.book.rightsSetting.dto.RightsSettingDto;
import com.pcloud.book.rightsSetting.dto.RightsSettingShowStateDTO;
import com.pcloud.book.rightsSetting.entity.BaseTempletClassify; import com.pcloud.book.rightsSetting.entity.BaseTempletClassify;
import com.pcloud.book.rightsSetting.entity.RightsItemGroup; import com.pcloud.book.rightsSetting.entity.RightsItemGroup;
import com.pcloud.book.rightsSetting.entity.RightsNowPic; import com.pcloud.book.rightsSetting.entity.RightsNowPic;
...@@ -130,4 +131,10 @@ public interface RightsSettingBiz { ...@@ -130,4 +131,10 @@ public interface RightsSettingBiz {
* 根据书以及阅读方式查询周权益下的咨询 * 根据书以及阅读方式查询周权益下的咨询
*/ */
PageBeanNew<AppletNewsDTO> getWeekRightsSettingNewsByBookId(AppletUserBookcase userReadBook, Integer currentPage, Integer numPerPage); PageBeanNew<AppletNewsDTO> getWeekRightsSettingNewsByBookId(AppletUserBookcase userReadBook, Integer currentPage, Integer numPerPage);
/**
* 书刊权益批量上下架
* @param rightsSettingShowStateDTO
*/
void batchUpdateShowState(RightsSettingShowStateDTO rightsSettingShowStateDTO);
} }
...@@ -58,6 +58,7 @@ import com.pcloud.book.rightsSetting.dao.RightsSettingItemDetailDao; ...@@ -58,6 +58,7 @@ import com.pcloud.book.rightsSetting.dao.RightsSettingItemDetailDao;
import com.pcloud.book.rightsSetting.dto.FillRightsSettingAppletsDTO; import com.pcloud.book.rightsSetting.dto.FillRightsSettingAppletsDTO;
import com.pcloud.book.rightsSetting.dto.ReadTypeCountDTO; import com.pcloud.book.rightsSetting.dto.ReadTypeCountDTO;
import com.pcloud.book.rightsSetting.dto.RightsSettingDto; import com.pcloud.book.rightsSetting.dto.RightsSettingDto;
import com.pcloud.book.rightsSetting.dto.RightsSettingShowStateDTO;
import com.pcloud.book.rightsSetting.entity.BaseTempletClassify; import com.pcloud.book.rightsSetting.entity.BaseTempletClassify;
import com.pcloud.book.rightsSetting.entity.RightsCustomRelation; import com.pcloud.book.rightsSetting.entity.RightsCustomRelation;
import com.pcloud.book.rightsSetting.entity.RightsItemGroup; import com.pcloud.book.rightsSetting.entity.RightsItemGroup;
...@@ -93,11 +94,13 @@ import com.pcloud.common.utils.NumberUtil; ...@@ -93,11 +94,13 @@ import com.pcloud.common.utils.NumberUtil;
import com.pcloud.common.utils.cache.redis.JedisClusterUtils; import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
import com.pcloud.common.utils.string.StringUtil; import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.common.utils.string.StringUtilParent; import com.pcloud.common.utils.string.StringUtilParent;
import com.pcloud.readercenter.common.enums.YesOrNoNumEnum;
import com.pcloud.resourcecenter.product.dto.ProductDto; import com.pcloud.resourcecenter.product.dto.ProductDto;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -1647,11 +1650,11 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -1647,11 +1650,11 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
public RightsSettingDto getRightsSettingByBookId4AppletHome(Long bookId, Long adviserId, Long channelId) { public RightsSettingDto getRightsSettingByBookId4AppletHome(Long bookId, Long adviserId, Long channelId) {
//根据书获取权益 //根据书获取权益
RightsSettingDto rightsSettingDto = rightsSettingDAO.getByBookId(bookId); RightsSettingDto rightsSettingDto = rightsSettingDAO.getByBookId(bookId);
if (null != rightsSettingDto) { if (null != rightsSettingDto && Objects.equals(Boolean.TRUE, rightsSettingDto.getShowState()) ) {
rightsSettingDto rightsSettingDto
.setRightsSettingBookRelations(rightsSettingBookRelationMapper.selectByRithsSettingId(rightsSettingDto.getId())); .setRightsSettingBookRelations(rightsSettingBookRelationMapper.selectByRithsSettingId(rightsSettingDto.getId()));
} }
if (null == rightsSettingDto) { if (null == rightsSettingDto || !Objects.equals(Boolean.TRUE, rightsSettingDto.getShowState())) {
//根据分类获取权益 //根据分类获取权益
BookAdviserDto adviserDto = bookAdviserBiz.getBase(bookId, channelId, adviserId); BookAdviserDto adviserDto = bookAdviserBiz.getBase(bookId, channelId, adviserId);
if (null != adviserDto) { if (null != adviserDto) {
...@@ -2312,7 +2315,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -2312,7 +2315,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
AppletUserBookcase appletUserBookcase = appletUserBookcaseBiz.getUserReadType(wechatUserId, bookId, adviserId, channelId); AppletUserBookcase appletUserBookcase = appletUserBookcaseBiz.getUserReadType(wechatUserId, bookId, adviserId, channelId);
Integer chooseReadType = null == appletUserBookcase || null == appletUserBookcase.getReadType() ? null : Integer chooseReadType = null == appletUserBookcase || null == appletUserBookcase.getReadType() ? null :
appletUserBookcase.getReadType(); appletUserBookcase.getReadType();
if (null != rightsSettingDto) { if (null != rightsSettingDto && Objects.equals(Boolean.TRUE, rightsSettingDto.getShowState())) {
Long rightsSettingId = rightsSettingDto.getId(); Long rightsSettingId = rightsSettingDto.getId();
rightsSettingDto rightsSettingDto
.setRightsSettingBookRelations(rightsSettingBookRelationMapper.selectByRithsSettingId(rightsSettingDto.getId())); .setRightsSettingBookRelations(rightsSettingBookRelationMapper.selectByRithsSettingId(rightsSettingDto.getId()));
...@@ -2560,6 +2563,12 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -2560,6 +2563,12 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
} }
} }
@Override
@ParamLog("批量上下架")
public void batchUpdateShowState(RightsSettingShowStateDTO rightsSettingShowStateDTO) {
rightsSettingDAO.batchUpdateShowState(rightsSettingShowStateDTO);
}
private PageBeanNew<AppletNewsDTO> getAppletNewsDTOPageBeanNew(AppletUserBookcase userReadBook, Integer currentPage, Integer numPerPage) { private PageBeanNew<AppletNewsDTO> getAppletNewsDTOPageBeanNew(AppletUserBookcase userReadBook, Integer currentPage, Integer numPerPage) {
PageBeanNew<AppletNewsDTO> appletNewsDTOS = new PageBeanNew<>(); PageBeanNew<AppletNewsDTO> appletNewsDTOS = new PageBeanNew<>();
// 查询书籍分类下对应的资讯分类 // 查询书籍分类下对应的资讯分类
......
package com.pcloud.book.rightsSetting.dao; package com.pcloud.book.rightsSetting.dao;
import com.pcloud.book.rightsSetting.dto.RightsSettingDto; import com.pcloud.book.rightsSetting.dto.RightsSettingDto;
import com.pcloud.book.rightsSetting.dto.RightsSettingShowStateDTO;
import com.pcloud.book.rightsSetting.entity.RightsSetting; import com.pcloud.book.rightsSetting.entity.RightsSetting;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
...@@ -23,4 +24,6 @@ public interface RightsSettingDAO extends BaseDao<RightsSetting> { ...@@ -23,4 +24,6 @@ public interface RightsSettingDAO extends BaseDao<RightsSetting> {
List<RightsSettingDto> listRightsSettingPage(Map<String,Object> map); List<RightsSettingDto> listRightsSettingPage(Map<String,Object> map);
List<RightsSettingDto> listByBookId(Long bookId); List<RightsSettingDto> listByBookId(Long bookId);
void batchUpdateShowState(RightsSettingShowStateDTO rightsSettingShowStateDTO);
} }
...@@ -2,6 +2,7 @@ package com.pcloud.book.rightsSetting.dao.impl; ...@@ -2,6 +2,7 @@ package com.pcloud.book.rightsSetting.dao.impl;
import com.pcloud.book.rightsSetting.dao.RightsSettingDAO; import com.pcloud.book.rightsSetting.dao.RightsSettingDAO;
import com.pcloud.book.rightsSetting.dto.RightsSettingDto; import com.pcloud.book.rightsSetting.dto.RightsSettingDto;
import com.pcloud.book.rightsSetting.dto.RightsSettingShowStateDTO;
import com.pcloud.book.rightsSetting.entity.RightsSetting; import com.pcloud.book.rightsSetting.entity.RightsSetting;
import com.pcloud.common.core.dao.BaseDaoImpl; import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -58,4 +59,9 @@ public class RightsSettingDAOImpl extends BaseDaoImpl<RightsSetting> implement ...@@ -58,4 +59,9 @@ public class RightsSettingDAOImpl extends BaseDaoImpl<RightsSetting> implement
public List<RightsSettingDto> listByBookId(Long bookId) { public List<RightsSettingDto> listByBookId(Long bookId) {
return getSessionTemplate().selectList(getStatement("listByBookId"), bookId); return getSessionTemplate().selectList(getStatement("listByBookId"), bookId);
} }
@Override
public void batchUpdateShowState(RightsSettingShowStateDTO rightsSettingShowStateDTO) {
getSessionTemplate().update(getStatement("batchUpdateShowState"), rightsSettingShowStateDTO);
}
} }
package com.pcloud.book.rightsSetting.dto;
import lombok.Data;
import java.util.List;
@Data
public class RightsSettingShowStateDTO {
private List<Long> rightsSettingIds;
private Boolean showState;
}
...@@ -144,6 +144,9 @@ public class RightsSetting extends BaseTempletClassify { ...@@ -144,6 +144,9 @@ public class RightsSetting extends BaseTempletClassify {
@ApiModelProperty("版本标签") @ApiModelProperty("版本标签")
private Long verLabelId; private Long verLabelId;
@ApiModelProperty("上下架状态")
private Boolean showState;
public RightsSetting() { public RightsSetting() {
} }
......
package com.pcloud.book.rightsSetting.facade; package com.pcloud.book.rightsSetting.facade;
import com.pcloud.book.applet.vo.AppletNewsShowStateVO;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.rightsSetting.biz.RightsSettingBiz; import com.pcloud.book.rightsSetting.biz.RightsSettingBiz;
import com.pcloud.book.rightsSetting.dto.RightsSettingDto; import com.pcloud.book.rightsSetting.dto.RightsSettingDto;
import com.pcloud.book.rightsSetting.dto.RightsSettingShowStateDTO;
import com.pcloud.book.rightsSetting.entity.RightsNowPic; import com.pcloud.book.rightsSetting.entity.RightsNowPic;
import com.pcloud.book.rightsSetting.entity.RightsSetting; import com.pcloud.book.rightsSetting.entity.RightsSetting;
import com.pcloud.book.rightsSetting.entity.RightsSettingClassify; import com.pcloud.book.rightsSetting.entity.RightsSettingClassify;
...@@ -10,6 +12,7 @@ import com.pcloud.book.rightsSetting.entity.RightsSettingItem; ...@@ -10,6 +12,7 @@ import com.pcloud.book.rightsSetting.entity.RightsSettingItem;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.permission.PermissionException; import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.SessionUtil; import com.pcloud.common.utils.SessionUtil;
import com.pcloud.common.utils.cookie.Cookie; import com.pcloud.common.utils.cookie.Cookie;
import com.pcloud.common.utils.string.StringUtil; import com.pcloud.common.utils.string.StringUtil;
...@@ -296,4 +299,17 @@ public class RightsSettingFacede { ...@@ -296,4 +299,17 @@ public class RightsSettingFacede {
RightsSettingDto rightsSettingDto = rightsSettingBiz.getReadType4Book(wechatUserId,bookId,channelId,adviserId); RightsSettingDto rightsSettingDto = rightsSettingBiz.getReadType4Book(wechatUserId,bookId,channelId,adviserId);
return new ResponseDto<>(rightsSettingDto); return new ResponseDto<>(rightsSettingDto);
} }
@ApiOperation("批量上下架")
@PostMapping("batchUpdateShowState")
public ResponseDto<?> batchUpdateShowState(
@RequestHeader("token") String token,
@RequestBody RightsSettingShowStateDTO rightsSettingShowStateDTO) throws PermissionException {
SessionUtil.getInfoToken4Redis(token);
if (null == rightsSettingShowStateDTO || ListUtils.isEmpty(rightsSettingShowStateDTO.getRightsSettingIds()) || null == rightsSettingShowStateDTO.getShowState()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "缺少参数");
}
rightsSettingBiz.batchUpdateShowState(rightsSettingShowStateDTO);
return new ResponseDto<>();
}
} }
\ No newline at end of file
...@@ -48,14 +48,14 @@ ...@@ -48,14 +48,14 @@
a.SUB_LABEL_ID subjectLabelId, a.SUB_LABEL_ID subjectLabelId,
a.vol_label_id volLabelId, a.vol_label_id volLabelId,
IF(d.join_group_type=1 OR d.related_book_group_id>0,1,0) hasGroup, IF(d.join_group_type=1 OR d.related_book_group_id>0,1,0) hasGroup,
c.rights_setting_id rightsSettingId, r.id rightsSettingId,
r.count rightsSettingCount r.count rightsSettingCount
FROM applet_user_bookcase c FROM applet_user_bookcase c
LEFT JOIN BOOK_ADVISER a ON c.book_id=a.BOOK_ID AND c.adviser_id=a.ADVISER_ID LEFT JOIN BOOK_ADVISER a ON c.book_id=a.BOOK_ID AND c.adviser_id=a.ADVISER_ID
AND c.channel_id=a.CHANNEL_ID AND a.IS_DELETE = 0 AND c.channel_id=a.CHANNEL_ID AND a.IS_DELETE = 0
INNER JOIN BOOK b ON c.BOOK_ID = b.BOOK_ID AND b.IS_DELETE = 0 INNER JOIN BOOK b ON c.BOOK_ID = b.BOOK_ID AND b.IS_DELETE = 0
LEFT JOIN book_group d ON d.BOOK_ID = a.BOOK_ID and d.create_user=c.adviser_id and d.channel_id=c.channel_id AND d.IS_DELETE = 0 LEFT JOIN book_group d ON d.BOOK_ID = a.BOOK_ID and d.create_user=c.adviser_id and d.channel_id=c.channel_id AND d.IS_DELETE = 0
LEFT JOIN rights_setting r ON c.rights_setting_id = r.id AND d.join_group_type=4 LEFT JOIN rights_setting r ON c.rights_setting_id = r.id AND d.join_group_type=4 and r.show_state = 1 and r.rights_setting_type = 2
WHERE c.wechat_user_id=#{wechatUserId} WHERE c.wechat_user_id=#{wechatUserId}
ORDER BY c.create_time DESC ORDER BY c.create_time DESC
</select> </select>
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
<result column="guide_id" property="guideId" jdbcType="BIGINT" /> <result column="guide_id" property="guideId" jdbcType="BIGINT" />
<result column="guide_pic" property="guidePic" jdbcType="VARCHAR" /> <result column="guide_pic" property="guidePic" jdbcType="VARCHAR" />
<result column="ver_label_id" property="verLabelId" jdbcType="BIGINT" /> <result column="ver_label_id" property="verLabelId" jdbcType="BIGINT" />
<result column="show_state" property="showState" jdbcType="BOOLEAN"/>
</resultMap> </resultMap>
<resultMap id="DtoResultMap" type="com.pcloud.book.rightsSetting.dto.RightsSettingDto"> <resultMap id="DtoResultMap" type="com.pcloud.book.rightsSetting.dto.RightsSettingDto">
...@@ -49,6 +50,7 @@ ...@@ -49,6 +50,7 @@
<result column="read_type_title" property="readTypeTitle" jdbcType="VARCHAR" /> <result column="read_type_title" property="readTypeTitle" jdbcType="VARCHAR" />
<result column="vol_label_id" property="volLabelId" jdbcType="BIGINT" /> <result column="vol_label_id" property="volLabelId" jdbcType="BIGINT" />
<result column="ver_label_id" property="verLabelId" jdbcType="BIGINT" /> <result column="ver_label_id" property="verLabelId" jdbcType="BIGINT" />
<result column="show_state" property="showState" jdbcType="BOOLEAN" />
</resultMap> </resultMap>
<resultMap id="DtoResultMap4Book" type="com.pcloud.book.rightsSetting.dto.RightsSettingDto" extends="DtoResultMap"> <resultMap id="DtoResultMap4Book" type="com.pcloud.book.rightsSetting.dto.RightsSettingDto" extends="DtoResultMap">
...@@ -60,13 +62,13 @@ ...@@ -60,13 +62,13 @@
id, introduce, detail, count, first_classify, second_classify, grade_label_id, subject_label_id, id, 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 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, ,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 reading_guide,guide_title,guide_type,guide_id,guide_pic,ver_label_id, show_state
</sql> </sql>
<sql id="Base_Column_List_own" > <sql id="Base_Column_List_own" >
r.id, r.introduce, r.detail, r.count, r.first_classify, r.second_classify, r.grade_label_id, r.subject_label_id, r.id, r.introduce, r.detail, r.count, r.first_classify, r.second_classify, r.grade_label_id, r.subject_label_id,
r.create_time, r.update_time, r.enable_group_service, r.rights_setting_type, r.book_id r.create_time, r.update_time, r.enable_group_service, r.rights_setting_type, r.book_id
,r.online_course_open,r.learning_tool_open,r.draw_open,r.read_type_title,r.vol_label_id,r.ver_label_id ,r.online_course_open,r.learning_tool_open,r.draw_open,r.read_type_title,r.vol_label_id,r.ver_label_id, r.show_state
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" > <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
...@@ -236,7 +238,7 @@ ...@@ -236,7 +238,7 @@
select select
r.id, r.introduce, r.detail, r.count, r.first_classify, r.second_classify, r.grade_label_id, r.subject_label_id, r.id, r.introduce, r.detail, r.count, r.first_classify, r.second_classify, r.grade_label_id, r.subject_label_id,
r.create_time, r.update_time, r.enable_group_service, r.rights_setting_type, r.book_id, b.BOOK_NAME, r.vol_label_id, r.create_time, r.update_time, r.enable_group_service, r.rights_setting_type, r.book_id, b.BOOK_NAME, r.vol_label_id,
r.ver_label_id r.ver_label_id, r.show_state
from from
rights_setting r rights_setting r
left join rights_setting_book_relation s on r.id = s.rights_setting_id left join rights_setting_book_relation s on r.id = s.rights_setting_id
...@@ -299,4 +301,16 @@ ...@@ -299,4 +301,16 @@
and rights_setting_type = 2 and rights_setting_type = 2
</select> </select>
<update id="batchUpdateShowState" parameterType="com.pcloud.book.rightsSetting.dto.RightsSettingShowStateDTO">
UPDATE
rights_setting
SET
show_state = #{showState},
update_time=NOW()
WHERE id IN
<foreach collection="rightsSettingIds" item="item" separator="," open="(" close=")" >
#{item}
</foreach>
</update>
</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