Commit 507941bd by 郑永强

feat: [none] 增加广告开关参数(默认关闭广告)

parent 14f64d67
......@@ -53,7 +53,7 @@ public interface AppletBannerBiz {
* @date:2020/7/17 16:03
* * @param null
*/
PageBeanNew<AppletBannerDTO> listBanner4Wechat(Integer currentPage, Integer numPerPage, Boolean showState, Long officialAccountsId, Long wechatUserId);
PageBeanNew<AppletBannerDTO> listBanner4Wechat(Integer currentPage, Integer numPerPage, Boolean showState, Long officialAccountsId, Long wechatUserId, Integer enableAdverting);
void bannerClickRecord(Long wechatUserId, Long bannerId, Integer locationType);
......
......@@ -339,18 +339,21 @@ public class AppletBannerBizImpl implements AppletBannerBiz {
}
@Override
public PageBeanNew<AppletBannerDTO> listBanner4Wechat(Integer currentPage, Integer numPerPage, Boolean showState, Long officialAccountsId, Long wechatUserId) {
public PageBeanNew<AppletBannerDTO> listBanner4Wechat(Integer currentPage, Integer numPerPage, Boolean showState, Long officialAccountsId, Long wechatUserId, Integer enableAdverting) {
Long agentId = appletNewsBiz.getAgentIdByAccountId(officialAccountsId);
PageBeanNew<AppletBannerDTO> pageBeanNew = listBanner(currentPage, numPerPage, showState, agentId);
// 依据当前用户正在读的书,所属分类获取最新上架的资讯
processFillType(pageBeanNew.getRecordList(), wechatUserId);
// 填充广告banner
this.fillAdvertising(pageBeanNew.getRecordList());
this.fillAdvertising(pageBeanNew.getRecordList(), enableAdverting);
return pageBeanNew;
}
private void fillAdvertising(List<AppletBannerDTO> recordList) {
private void fillAdvertising(List<AppletBannerDTO> recordList, Integer enableAdverting) {
try {
if(!YesOrNoEnums.YES.getValue().equals(enableAdverting)){
return;
}
// 获取广告
List<AdvertisingSpaceDTO> appletAdvertisingList = advertisingConsr.getAppletAdvertising();
if(CollUtil.isEmpty(appletAdvertisingList)){
......
......@@ -358,14 +358,15 @@ public class AppletHomeFacade {
public ResponseDto<PageBeanNew<AppletBannerDTO>> listBanner4Wechat(
@CookieValue("userInfo") String userInfo,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页数量") Integer numPerPage) {
@RequestParam("numPerPage") @ApiParam("每页数量") Integer numPerPage,
@RequestParam(value = "enableAdverting", required = false) @ApiParam("开启广告") Integer enableAdverting) {
Long officialAccountsId = Cookie.getId(userInfo,Cookie._OFFICIAL_ACCOUNTS_ID);
Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
if (null==currentPage || null == numPerPage){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少分页参数");
}
return new ResponseDto<>(appletBannerBiz.listBanner4Wechat(currentPage, numPerPage, true, officialAccountsId, wechatUserId));
return new ResponseDto<>(appletBannerBiz.listBanner4Wechat(currentPage, numPerPage, true, officialAccountsId, wechatUserId, enableAdverting));
}
@ApiOperation("获取书单下书籍列表")
......
......@@ -56,7 +56,7 @@ public interface ResourcePageBiz {
* @date:2021/3/29 11:49
* * @param null
*/
List<ResourceColumnAndServeVO> getColumnAndServeListByPageId(Long resourcePageId, Boolean isWechat, Long bookId, Long adviserId, Long channelId);
List<ResourceColumnAndServeVO> getColumnAndServeListByPageId(Long resourcePageId, Boolean isWechat, Long bookId, Long adviserId, Long channelId, Integer enableAdverting);
/**
* 根据书刊查资源页基本配置
* @author:zhuyajie
......
......@@ -65,6 +65,7 @@ import com.pcloud.book.rightsSetting.entity.RightsSettingBanner;
import com.pcloud.book.rightsSetting.entity.RightsSettingTitle;
import com.pcloud.book.skill.biz.PcloudGroupActivityBiz;
import com.pcloud.book.util.common.ThreadPoolUtils;
import com.pcloud.book.util.common.YesOrNoEnums;
import com.pcloud.book.util.properties.BookProps;
import com.pcloud.channelcenter.qrcode.dto.GroupQrcodeVO;
import com.pcloud.channelcenter.qrcode.dto.OwnMessageDTO;
......@@ -560,7 +561,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
}
@Override
public List<ResourceColumnAndServeVO> getColumnAndServeListByPageId(Long resourcePageId, Boolean isWechat, Long bookId, Long adviserId, Long channelId) {
public List<ResourceColumnAndServeVO> getColumnAndServeListByPageId(Long resourcePageId, Boolean isWechat, Long bookId, Long adviserId, Long channelId, Integer enableAdverting) {
List<ResourceColumnAndServeVO> serveVOS = resourcePageColumnDao.getColumnListByPageId(resourcePageId);
if (CollUtil.isNotEmpty(serveVOS)) {
List<ResourcePageItemVO> itemVOList;
......@@ -598,15 +599,15 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
serveVOS = CollUtil.toList();
}
// 填充广告
this.fillAdvertising(serveVOS, bookId, adviserId, channelId);
this.fillAdvertising(serveVOS, bookId, adviserId, channelId, enableAdverting);
return serveVOS;
}
/**
* 填充广告
*/
private void fillAdvertising(List<ResourceColumnAndServeVO> serveVOS, Long bookId, Long adviserId, Long channelId) {
if(serveVOS == null || bookId == null || adviserId == null || channelId == null){
private void fillAdvertising(List<ResourceColumnAndServeVO> serveVOS, Long bookId, Long adviserId, Long channelId, Integer enableAdverting) {
if(serveVOS == null || bookId == null || adviserId == null || channelId == null || !YesOrNoEnums.YES.getValue().equals(enableAdverting)){
return;
}
try {
......
......@@ -69,7 +69,7 @@ public class ResourcePageFacade {
public ResponseDto<?> getColumnAndServeListByPageId(@RequestHeader("token") String token,
@RequestParam("resourcePageId") Long resourcePageId){
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(resourcePageBiz.getColumnAndServeListByPageId(resourcePageId, false, null, null, null));
return new ResponseDto<>(resourcePageBiz.getColumnAndServeListByPageId(resourcePageId, false, null, null, null, null));
}
@ApiOperation("客户端-根据书刊查资源页基本配置")
......@@ -88,9 +88,10 @@ public class ResourcePageFacade {
@RequestParam("resourcePageId") Long resourcePageId,
@RequestParam(value = "bookId", required = false) Long bookId,
@RequestParam(value = "adviserId", required = false) Long adviserId,
@RequestParam(value = "channelId", required = false) Long channelId){
@RequestParam(value = "channelId", required = false) Long channelId,
@RequestParam(value = "enableAdverting", required = false) Integer enableAdverting){
Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
return new ResponseDto<>(resourcePageBiz.getColumnAndServeListByPageId(resourcePageId, true, bookId, adviserId, channelId));
return new ResponseDto<>(resourcePageBiz.getColumnAndServeListByPageId(resourcePageId, true, bookId, adviserId, channelId, enableAdverting));
}
@ApiOperation("客户端分页查栏目资源")
......
......@@ -1201,7 +1201,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
if (null == resourcePageVO || null == resourcePageVO.getId()) {
return;
}
List<ResourceColumnAndServeVO> serveVOList = resourcePageBiz.getColumnAndServeListByPageId(resourcePageVO.getId(), false, null, null, null);
List<ResourceColumnAndServeVO> serveVOList = resourcePageBiz.getColumnAndServeListByPageId(resourcePageVO.getId(), false, null, null, null, null);
UpdateResourceColumnVO columnVO = new UpdateResourceColumnVO();
columnVO.setColumnFormat(3);
columnVO.setColumnName("精品资讯");
......
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