Commit 61e38a20 by 田超
parents 2374deac cd9bf215
package com.pcloud.book.advertising.service;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.pcloud.common.exceptions.BizException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@FeignClient(value = "pcloud-service-book", qualifier = "advertisingSpaceServiceCloud", path = "book/v1.0/advertisingSpaceService")
@Api(description = "广告位内部接口")
public interface AdvertisingSpaceService {
/**
* 每日凌晨计算昨日广告位收益
* @throws BizException
*/
@ApiOperation(value = "每日凌晨计算昨日广告位收益", httpMethod = "GET")
@RequestMapping(value = "calculateAdvertisingIncomeYesterday", method = RequestMethod.GET)
void calculateAdvertisingIncomeYesterday() throws BizException;
}
...@@ -433,6 +433,16 @@ public class BookDto extends BaseDto { ...@@ -433,6 +433,16 @@ public class BookDto extends BaseDto {
private Long clickNum; private Long clickNum;
/** /**
* 广告位数量
*/
private Long advertisingSpaceNum;
/**
* 点击率
*/
private BigDecimal clickRate;
/**
* 公众号名称 * 公众号名称
*/ */
private String officialAccountsName; private String officialAccountsName;
...@@ -1271,6 +1281,23 @@ public class BookDto extends BaseDto { ...@@ -1271,6 +1281,23 @@ public class BookDto extends BaseDto {
public void setIsBookGroup(Boolean isBookGroup) { public void setIsBookGroup(Boolean isBookGroup) {
this.isBookGroup = isBookGroup; this.isBookGroup = isBookGroup;
} }
public BigDecimal getClickRate() {
return clickRate;
}
public void setClickRate(BigDecimal clickRate) {
this.clickRate = clickRate;
}
public Long getAdvertisingSpaceNum() {
return advertisingSpaceNum;
}
public void setAdvertisingSpaceNum(Long advertisingSpaceNum) {
this.advertisingSpaceNum = advertisingSpaceNum;
}
@Override @Override
public String toString() { public String toString() {
return "BookDto{" + return "BookDto{" +
...@@ -1357,6 +1384,8 @@ public class BookDto extends BaseDto { ...@@ -1357,6 +1384,8 @@ public class BookDto extends BaseDto {
", distributionTime=" + distributionTime + ", distributionTime=" + distributionTime +
", exposureNum=" + exposureNum + ", exposureNum=" + exposureNum +
", clickNum=" + clickNum + ", clickNum=" + clickNum +
", advertisingSpaceNum=" + advertisingSpaceNum +
", clickRate=" + clickRate +
", officialAccountsName='" + officialAccountsName + '\'' + ", officialAccountsName='" + officialAccountsName + '\'' +
", uniqueNumber='" + uniqueNumber + '\'' + ", uniqueNumber='" + uniqueNumber + '\'' +
", bookGroupId=" + bookGroupId + ", bookGroupId=" + bookGroupId +
......
...@@ -2,13 +2,16 @@ package com.pcloud.book.advertising.biz; ...@@ -2,13 +2,16 @@ package com.pcloud.book.advertising.biz;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.pcloud.book.advertising.dto.AdvertisingMasterDTO;
import com.pcloud.book.advertising.dto.AdvertisingSpaceDTO; import com.pcloud.book.advertising.dto.AdvertisingSpaceDTO;
import com.pcloud.book.advertising.entity.AdvertisingAdviserPermission; import com.pcloud.book.advertising.entity.AdvertisingAdviserPermission;
import com.pcloud.book.advertising.entity.AdvertisingAgentPermission; import com.pcloud.book.advertising.entity.AdvertisingAgentPermission;
import com.pcloud.book.advertising.entity.AdvertisingClickRecord; import com.pcloud.book.advertising.entity.AdvertisingClickRecord;
import com.pcloud.book.advertising.entity.AdvertisingDistributionBook; import com.pcloud.book.advertising.entity.AdvertisingDistributionBook;
import com.pcloud.book.advertising.entity.AdvertisingExposureRecord; import com.pcloud.book.advertising.entity.AdvertisingExposureRecord;
import com.pcloud.book.advertising.entity.AdvertisingMaster;
import com.pcloud.book.advertising.entity.AdvertisingSpace; import com.pcloud.book.advertising.entity.AdvertisingSpace;
import com.pcloud.book.group.dto.AdGroupQrcodeDTO;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBean; import com.pcloud.common.page.PageBean;
import com.pcloud.common.page.PageParam; import com.pcloud.common.page.PageParam;
...@@ -44,13 +47,6 @@ public interface AdvertisingSpaceBiz { ...@@ -44,13 +47,6 @@ public interface AdvertisingSpaceBiz {
void stop(AdvertisingSpace advertisingSpace) throws BizException; void stop(AdvertisingSpace advertisingSpace) throws BizException;
/** /**
* 删除广告位
* @param advertisingSpace 广告位实体
* @throws BizException
*/
void delete(AdvertisingSpace advertisingSpace) throws BizException;
/**
* 获取广告位信息 * 获取广告位信息
* @param adId 广告位ID * @param adId 广告位ID
* @return * @return
...@@ -67,6 +63,13 @@ public interface AdvertisingSpaceBiz { ...@@ -67,6 +63,13 @@ public interface AdvertisingSpaceBiz {
void distributeBook(AdvertisingDistributionBook book) throws BizException; void distributeBook(AdvertisingDistributionBook book) throws BizException;
/** /**
* 投放微信群
* @param book 广告位书刊实体
* @throws BizException
*/
void distributeWechatGroup(AdvertisingDistributionBook book) throws BizException;
/**
* 获取出版社书刊权限 * 获取出版社书刊权限
* @param agentId 出版社ID * @param agentId 出版社ID
* @return * @return
...@@ -109,6 +112,15 @@ public interface AdvertisingSpaceBiz { ...@@ -109,6 +112,15 @@ public interface AdvertisingSpaceBiz {
PageBean listBook4Platform(Map<String, Object> paramMap, PageParam pageParam, Long adviserId) throws BizException; PageBean listBook4Platform(Map<String, Object> paramMap, PageParam pageParam, Long adviserId) throws BizException;
/** /**
* 平台端获取社群书微信群列表
* @param paramMap 参数Map
* @param pageParam 分页参数
* @return
* @throws BizException
*/
PageBean listGroupQrcode4Platform(Map<String, Object> paramMap, PageParam pageParam) throws BizException;
/**
* 获取广告位投放书刊列表 * 获取广告位投放书刊列表
* @param adId 广告位ID * @param adId 广告位ID
* @param name 书刊名称 * @param name 书刊名称
...@@ -119,22 +131,39 @@ public interface AdvertisingSpaceBiz { ...@@ -119,22 +131,39 @@ public interface AdvertisingSpaceBiz {
PageBean distributionBookList(Long adId, String name, PageParam pageParam) throws BizException; PageBean distributionBookList(Long adId, String name, PageParam pageParam) throws BizException;
/** /**
* 获取广告位投放作品/应用数据统计 * 获取广告位投放微信群列表
* @param adId 广告位ID * @param adId 广告位ID
* @param name 书刊名称
* @param pageParam 分页参数 * @param pageParam 分页参数
* @return * @return
* @throws BizException * @throws BizException
*/ */
PageBean distributionAppStatics(Long adId, PageParam pageParam) throws BizException; PageBean distributionWechatGroupList(Long adId, String name, PageParam pageParam) throws BizException;
/** /**
* 获取广告位投放时间统计 * 获取广告位投放书刊列表
* @param adId 广告位ID * @param name 书刊名称
* @param day 天数 * @param pageParam 分页参数
* @return
* @throws BizException
*/
PageBean advertisingBookList(String name, PageParam pageParam) throws BizException;
/**
* 获取广告位投放微信群列表
* @param name 书刊名称
* @param pageParam 分页参数
* @return * @return
* @throws BizException * @throws BizException
*/ */
List<Object> distributionDateStatics(Long adId, Integer day) throws BizException; PageBean advertisingWechatGroupList(String name, PageParam pageParam) throws BizException;
/**
* 获取广告位投放微信群曝光量前几位
* @return
* @throws BizException
*/
List<AdGroupQrcodeDTO> advertisingWechatGroupRankTop() throws BizException;
/** /**
* 获取广告位列表 * 获取广告位列表
...@@ -146,14 +175,106 @@ public interface AdvertisingSpaceBiz { ...@@ -146,14 +175,106 @@ public interface AdvertisingSpaceBiz {
PageBean list(String name, PageParam pageParam) throws BizException; PageBean list(String name, PageParam pageParam) throws BizException;
/** /**
* 书刊广告位明细
* @param bookId 书刊ID
* @param channelId 运营ID
* @param adviserId 编辑ID
* @param statisMonth 统计月份
* @param pageParam 分页参数
* @return
* @throws BizException
*/
PageBean advertisingDetail4Book(Long bookId, Long channelId, Long adviserId, String statisMonth, PageParam pageParam) throws BizException;
/**
* 导出书刊广告位明细
* @param bookId 书刊ID
* @param channelId 运营ID
* @param adviserId 编辑ID
* @param statisMonth 统计月份
* @return
* @throws BizException
*/
Map<String, Object> exportAdvertisingDetail4Book(Long bookId, Long channelId, Long adviserId, String statisMonth) throws BizException;
/**
* 微信群广告位明细
* @param qrcodeId 微信群ID
* @param statisMonth 统计月份
* @param pageParam 分页参数
* @return
* @throws BizException
*/
PageBean advertisingDetail4WechatGroup(Long qrcodeId, String statisMonth, PageParam pageParam) throws BizException;
/**
* 导出微信群广告位明细
* @param qrcodeId 微信群ID
* @param statisMonth 统计月份
* @return
* @throws BizException
*/
Map<String, Object> exportAdvertisingDetail4WechatGroup(Long qrcodeId, String statisMonth) throws BizException;
/**
* 微信群广告位点击读者列表
* @param qrcodeId 微信群ID
* @param adId 广告位ID
* @param statisMonth 统计月份
* @param pageParam 分页参数
* @return
* @throws BizException
*/
PageBean clickUserList4AdvertisingWechatGroup(Long qrcodeId, Long adId, String statisMonth, PageParam pageParam) throws BizException;
/**
* 导出微信群广告位点击读者列表
* @param qrcodeId 微信群ID
* @param adId 广告位ID
* @param statisMonth 统计月份
* @return
* @throws BizException
*/
Map<String, Object> exportClickUserList4AdvertisingWechatGroup(Long qrcodeId, Long adId, String statisMonth) throws BizException;
/**
* 广告主广告位明细
* @param qrcodeId 微信群ID
* @param statisMonth 统计月份
* @param pageParam 分页参数
* @return
* @throws BizException
*/
PageBean advertisingDetail4Master(Long masterId, String statisMonth, PageParam pageParam) throws BizException;
/**
* 导出广告主广告位明细
* @param masterId 广告主ID
* @param statisMonth 统计月份
* @return
* @throws BizException
*/
Map<String, Object> exportAdvertisingDetail4Master(Long masterId, String statisMonth) throws BizException;
/**
* 客户端获取书刊配置的广告位信息 * 客户端获取书刊配置的广告位信息
* @param sceneId 二维码ID * @param sceneId 二维码ID
* @param adviserId 编辑ID * @param adviserId 编辑ID
* @param channelId 运营ID * @param channelId 运营ID
* @param adPositionDetail 广告具体位置
* @return
* @throws BizException
*/
List<AdvertisingSpaceDTO> get4Wechat(Long sceneId, Long adviserId, Long channelId, String adPositionDetail) throws BizException;
/**
* 获取社群书配置的广告位信息
* @param bookGroupId 社群码ID
* @param adPositionDetail 广告具体位置
* @return * @return
* @throws BizException * @throws BizException
*/ */
AdvertisingSpaceDTO get4Wechat(Long sceneId, Long adviserId, Long channelId) throws BizException; AdvertisingSpaceDTO getBookGroupAd4Wechat(Long bookGroupId, String adPositionDetail) throws BizException;
/** /**
* 曝光量埋点 * 曝光量埋点
...@@ -168,4 +289,83 @@ public interface AdvertisingSpaceBiz { ...@@ -168,4 +289,83 @@ public interface AdvertisingSpaceBiz {
* @throws BizException * @throws BizException
*/ */
void addClickTrack(AdvertisingClickRecord advertisingClickRecord) throws BizException; void addClickTrack(AdvertisingClickRecord advertisingClickRecord) throws BizException;
/**
* 添加广告主
* @param advertisingMaster 广告主实体
* @throws BizException
*/
void createMaster(AdvertisingMaster advertisingMaster) throws BizException;
/**
* 修改广告主
* @param advertisingMaster 广告主实体
* @throws BizException
*/
void updateMaster(AdvertisingMaster advertisingMaster) throws BizException;
/**
* 获取广告主列表
* @param pageParam 分页参数
* @param masterName 广告主名称
* @return
* @throws BizException
*/
PageBean getMasterList(PageParam pageParam, String masterName) throws BizException;
/**
* 获取所有广告主
* @return
* @throws BizException
*/
List<AdvertisingMasterDTO> getAllMaster() throws BizException;
/**
* 获取广告主信息
* @param masterId 广告主ID
* @return
* @throws BizException
*/
AdvertisingMasterDTO getMasterInfo(Long masterId) throws BizException;
/**
* 每日凌晨计算昨日广告位收益
* @throws BizException
*/
void calculateAdvertisingIncomeYesterday() throws BizException;
/**
* 获取概览数据
* @return
* @throws BizException
*/
Map<String, Object> overviewStatis() throws BizException;
/**
* 获取流量趋势
* @param day 天数
* @param startDate 开始时间
* @param endDate 结束时间
* @return
* @throws BizException
*/
List<Object> getFlowStatisTrend(Integer day, String startDate, String endDate) throws BizException;
/**
* 获取收益趋势
* @param day 天数
* @param startDate 开始时间
* @param endDate 结束时间
* @return
* @throws BizException
*/
List<Object> getIncomeStatisTrend(Integer day, String startDate, String endDate) throws BizException;
/**
* 获取微信群信息
* @param qrcodeId 微信群ID
* @return
* @throws BizException
*/
AdGroupQrcodeDTO getGroupQrcodeInfo(Long qrcodeId) throws BizException;
} }
package com.pcloud.book.advertising.biz.impl; package com.pcloud.book.advertising.biz.impl;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
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.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.pcloud.appcenter.app.dto.AppDto; import com.pcloud.appcenter.app.dto.AppTypeDto;
import com.pcloud.appcenter.app.service.AppTypeService;
import com.pcloud.book.advertising.biz.AdvertisingSpaceBiz; import com.pcloud.book.advertising.biz.AdvertisingSpaceBiz;
import com.pcloud.book.advertising.dao.AdvertisingAdviserPermissionDao; import com.pcloud.book.advertising.dao.AdvertisingAdviserPermissionDao;
import com.pcloud.book.advertising.dao.AdvertisingAgentPermissionDao; import com.pcloud.book.advertising.dao.AdvertisingAgentPermissionDao;
import com.pcloud.book.advertising.dao.AdvertisingClickRecordDao; import com.pcloud.book.advertising.dao.AdvertisingClickRecordDao;
import com.pcloud.book.advertising.dao.AdvertisingDistributionBookDao; import com.pcloud.book.advertising.dao.AdvertisingDistributionBookDao;
import com.pcloud.book.advertising.dao.AdvertisingExposureRecordDao; import com.pcloud.book.advertising.dao.AdvertisingExposureRecordDao;
import com.pcloud.book.advertising.dao.AdvertisingIncomeDailyDao;
import com.pcloud.book.advertising.dao.AdvertisingMasterDao;
import com.pcloud.book.advertising.dao.AdvertisingSettlementMethodDao;
import com.pcloud.book.advertising.dao.AdvertisingSpaceDao; import com.pcloud.book.advertising.dao.AdvertisingSpaceDao;
import com.pcloud.book.advertising.dto.AdvertisingMasterDTO;
import com.pcloud.book.advertising.dto.AdvertisingSettlementMethodDTO;
import com.pcloud.book.advertising.dto.AdvertisingSpaceDTO; import com.pcloud.book.advertising.dto.AdvertisingSpaceDTO;
import com.pcloud.book.advertising.dto.DistributionAppDTO; import com.pcloud.book.advertising.dto.WechatGroupClickUserDTO;
import com.pcloud.book.advertising.entity.AdvertisingAdviserPermission; import com.pcloud.book.advertising.entity.AdvertisingAdviserPermission;
import com.pcloud.book.advertising.entity.AdvertisingAgentPermission; import com.pcloud.book.advertising.entity.AdvertisingAgentPermission;
import com.pcloud.book.advertising.entity.AdvertisingClickRecord; import com.pcloud.book.advertising.entity.AdvertisingClickRecord;
import com.pcloud.book.advertising.entity.AdvertisingDistributionBook; import com.pcloud.book.advertising.entity.AdvertisingDistributionBook;
import com.pcloud.book.advertising.entity.AdvertisingExposureRecord; import com.pcloud.book.advertising.entity.AdvertisingExposureRecord;
import com.pcloud.book.advertising.entity.AdvertisingMaster;
import com.pcloud.book.advertising.entity.AdvertisingSettlementMethod;
import com.pcloud.book.advertising.entity.AdvertisingSpace; import com.pcloud.book.advertising.entity.AdvertisingSpace;
import com.pcloud.book.advertising.entity.DistributionWechatGroup;
import com.pcloud.book.advertising.enums.AdPositionDetailEnum;
import com.pcloud.book.advertising.enums.AdPositionEnum; import com.pcloud.book.advertising.enums.AdPositionEnum;
import com.pcloud.book.advertising.enums.AdSourceEnum; import com.pcloud.book.advertising.enums.AdPositionModeEnum;
import com.pcloud.book.advertising.enums.DistributionTypeEnum; import com.pcloud.book.advertising.enums.SettlementMethodEnum;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.biz.BookBiz; import com.pcloud.book.book.biz.BookBiz;
import com.pcloud.book.book.dao.BookDao; import com.pcloud.book.book.dao.BookDao;
...@@ -37,20 +52,40 @@ import com.pcloud.book.book.dto.BookDto; ...@@ -37,20 +52,40 @@ import com.pcloud.book.book.dto.BookDto;
import com.pcloud.book.book.entity.BookAdviser; import com.pcloud.book.book.entity.BookAdviser;
import com.pcloud.book.book.set.BookSet; import com.pcloud.book.book.set.BookSet;
import com.pcloud.book.consumer.app.AppConsr; import com.pcloud.book.consumer.app.AppConsr;
import com.pcloud.book.consumer.common.ExportConsr;
import com.pcloud.book.consumer.reader.ReaderConsr;
import com.pcloud.book.consumer.resource.ProductConsr; import com.pcloud.book.consumer.resource.ProductConsr;
import com.pcloud.book.consumer.user.AdviserConsr; import com.pcloud.book.consumer.user.AdviserConsr;
import com.pcloud.book.consumer.user.AgentConsr;
import com.pcloud.book.consumer.user.ChannelConsr; import com.pcloud.book.consumer.user.ChannelConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.group.dao.BookGroupClassifyDao;
import com.pcloud.book.group.dao.BookGroupDao;
import com.pcloud.book.group.dao.GroupQrcodeDao;
import com.pcloud.book.group.dto.AdGroupQrcodeDTO;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.ClassifyDTO;
import com.pcloud.book.group.dto.GroupQrcodeInfoDTO;
import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.entity.GroupQrcode;
import com.pcloud.book.util.common.CommonUtils; import com.pcloud.book.util.common.CommonUtils;
import com.pcloud.channelcenter.qrcode.service.QrcodeSceneService; import com.pcloud.channelcenter.qrcode.service.QrcodeSceneService;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBean; import com.pcloud.common.page.PageBean;
import com.pcloud.common.page.PageParam; import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.DateNewUtils;
import com.pcloud.common.utils.DateUtils; import com.pcloud.common.utils.DateUtils;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.ResponseHandleUtil; import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.common.utils.httpclient.UrlUtils;
import com.pcloud.common.utils.string.StringUtil; import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.resourcecenter.product.dto.Product4BookDTO; import com.pcloud.readercenter.wechat.entity.WechatUser;
import com.pcloud.resourcecenter.product.service.ProductService;
import com.sdk.wxgroup.SendArticleMessageVO;
import com.sdk.wxgroup.SendPicMessageVO;
import com.sdk.wxgroup.SendTextMessageVO;
import com.sdk.wxgroup.WxGroupSDK;
/** /**
* Description 广告位业务逻辑层接口实现类 * Description 广告位业务逻辑层接口实现类
...@@ -60,6 +95,9 @@ import com.pcloud.resourcecenter.product.dto.Product4BookDTO; ...@@ -60,6 +95,9 @@ import com.pcloud.resourcecenter.product.dto.Product4BookDTO;
@Component("advertisingSpaceBiz") @Component("advertisingSpaceBiz")
public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz { public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
@Value("${wechat.group.link.prefix}")
private String wechatGroupLinkPrefix;
@Autowired @Autowired
private AdvertisingSpaceDao advertisingSpaceDao; private AdvertisingSpaceDao advertisingSpaceDao;
@Autowired @Autowired
...@@ -88,6 +126,30 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz { ...@@ -88,6 +126,30 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
private ProductConsr productConsr; private ProductConsr productConsr;
@Autowired @Autowired
private AppConsr appConsr; private AppConsr appConsr;
@Autowired
private AdvertisingMasterDao advertisingMasterDao;
@Autowired
private AdvertisingSettlementMethodDao advertisingSettlementMethodDao;
@Autowired
private AdvertisingIncomeDailyDao advertisingIncomeDailyDao;
@Autowired
private BookGroupClassifyDao bookGroupClassifyDao;
@Autowired
private GroupQrcodeDao groupQrcodeDao;
@Autowired
private AgentConsr agentConsr;
@Autowired
private WechatGroupConsr wechatGroupConsr;
@Autowired
private ExportConsr exportConsr;
@Autowired
private ProductService productService;
@Autowired
private AppTypeService appTypeService;
@Autowired
private BookGroupDao bookGroupDao;
@Autowired
private ReaderConsr readerConsr;
/** /**
* 创建广告位 * 创建广告位
...@@ -96,20 +158,49 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz { ...@@ -96,20 +158,49 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ParamLog("创建广告位") @ParamLog("创建广告位")
public Long create(AdvertisingSpace advertisingSpace) throws BizException { public Long create(AdvertisingSpace advertisingSpace) throws BizException {
if (null == advertisingSpace.getAdName() || null == advertisingSpace.getAdPosition() // 校验参数
|| null == advertisingSpace.getAdSource() || null == advertisingSpace.getAdLink()) { checkParamBeforeCreate(advertisingSpace);
String settlementMethod = advertisingSpace.getSettlementMethod();
advertisingSpace.setIsOpen(true);
advertisingSpaceDao.insert(advertisingSpace);
Long adId = advertisingSpace.getId();
AdvertisingSettlementMethod method = new AdvertisingSettlementMethod();
method.setMasterId(advertisingSpace.getMasterId());
method.setAdId(adId);
method.setSettlementMethod(settlementMethod);
method.setPriceEachTime(advertisingSpace.getPriceEachTime());
advertisingSettlementMethodDao.insert(method);
return adId;
}
/**
* 新增前校验参数
*/
private void checkParamBeforeCreate(AdvertisingSpace advertisingSpace) {
String adPosition = advertisingSpace.getAdPosition();
if (null == advertisingSpace.getAdName() || null == adPosition || null == advertisingSpace.getAdPositionMode()
|| null == advertisingSpace.getMasterId() || null == advertisingSpace.getSettlementMethod()) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!");
} }
if (!AdPositionEnum.checkCodeExist(advertisingSpace.getAdPosition())) { if (!AdPositionEnum.checkCodeExist(adPosition)) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "广告位置选择有误!");
}
if (!AdPositionModeEnum.checkCodeExist(adPosition, advertisingSpace.getAdPositionMode())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "广告位置选择有误!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "广告位置选择有误!");
} }
if (!ArrayUtils.contains(AdSourceEnum.AD_SOURCE_GATHER, advertisingSpace.getAdSource())) { if (AdPositionEnum.BOOK_GROUP_PAGE.equals(adPosition)
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "广告来源选择有误!"); && !AdPositionDetailEnum.checkCodeExist(adPosition, advertisingSpace.getAdPositionDetail())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "广告位置选择有误!");
}
String settlementMethod = advertisingSpace.getSettlementMethod();
if (AdPositionEnum.WECHAT_GROUP_MSG.equals(adPosition)
&& !SettlementMethodEnum.CPM.code.equals(settlementMethod)) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "微信群消息仅支持按曝光量结算!");
}
if (ArrayUtils.contains(SettlementMethodEnum.SETTLEMENT_METHOD_NEED_PRICE_GATHER, settlementMethod)
&& null == advertisingSpace.getPriceEachTime()) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "按点击量结算和按曝光量结算时每次价格不能为空!");
} }
advertisingSpace.setDistributionType(DistributionTypeEnum.SIGN_BOOK.value);
advertisingSpace.setIsOpen(true);
advertisingSpaceDao.insert(advertisingSpace);
return advertisingSpace.getId();
} }
/** /**
...@@ -119,21 +210,35 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz { ...@@ -119,21 +210,35 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ParamLog(value = "修改广告位", isAfterReturn = false) @ParamLog(value = "修改广告位", isAfterReturn = false)
public void update(AdvertisingSpace advertisingSpace) throws BizException { public void update(AdvertisingSpace advertisingSpace) throws BizException {
if (null == advertisingSpace.getId() || null == advertisingSpace.getAdName() || null == advertisingSpace.getAdPosition() // 校验参数
|| null == advertisingSpace.getAdSource() || null == advertisingSpace.getAdLink()) { checkParamBeforeCreate(advertisingSpace);
if (null == advertisingSpace.getId()) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!");
} }
if (!AdPositionEnum.checkCodeExist(advertisingSpace.getAdPosition())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "广告位置选择有误!");
}
if (!ArrayUtils.contains(AdSourceEnum.AD_SOURCE_GATHER, advertisingSpace.getAdSource())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "广告来源选择有误!");
}
AdvertisingSpace space = advertisingSpaceDao.getById(advertisingSpace.getId()); AdvertisingSpace space = advertisingSpaceDao.getById(advertisingSpace.getId());
if (null == space) { if (null == space) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "广告位不存在或已删除!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "广告位不存在或已删除!");
} }
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("adId", advertisingSpace.getId());
Integer bookNum = (Integer) advertisingDistributionBookDao.getBy(paramMap, "countByAdId");
// 已投放
if (null != bookNum && bookNum > 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "已投放书刊的广告位不能修改!");
}
advertisingSpaceDao.update(advertisingSpace); advertisingSpaceDao.update(advertisingSpace);
// 修改结算方式
AdvertisingSettlementMethodDTO methodDTO = advertisingSettlementMethodDao.getByMasterIdAndAdId(space.getMasterId(), space.getId());
AdvertisingSettlementMethod method = new AdvertisingSettlementMethod();
method.setMasterId(advertisingSpace.getMasterId());
method.setSettlementMethod(advertisingSpace.getSettlementMethod());
method.setPriceEachTime(advertisingSpace.getPriceEachTime());
if (null == methodDTO || null == methodDTO.getId()) {
advertisingSettlementMethodDao.insert(method);
} else {
method.setId(methodDTO.getId());
advertisingSettlementMethodDao.update(method);
}
} }
/** /**
...@@ -158,89 +263,237 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz { ...@@ -158,89 +263,237 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
} }
/** /**
* 删除广告位 * 获取广告位信息
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @ParamLog(value = "获取广告位信息")
@ParamLog(value = "删除广告位", isAfterReturn = false) public AdvertisingSpaceDTO get(Long adId) throws BizException {
public void delete(AdvertisingSpace advertisingSpace) throws BizException { AdvertisingSpaceDTO spaceDTO = advertisingSpaceDao.getDTOById(adId);
if (null == advertisingSpace.getId()) { if (null != spaceDTO) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!"); AdvertisingMaster master = advertisingMasterDao.getById(spaceDTO.getMasterId());
} if (null != master) {
AdvertisingSpace space = advertisingSpaceDao.getById(advertisingSpace.getId()); spaceDTO.setMasterName(master.getMasterName());
if (null == space) { }
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "广告位不存在或已删除!"); AdvertisingSettlementMethodDTO methodDTO = advertisingSettlementMethodDao.getByMasterIdAndAdId(spaceDTO.getMasterId(), spaceDTO.getId());
} if (null != methodDTO) {
if (DistributionTypeEnum.NO_SIGN_BOOK.value.equals(space.getDistributionType())) { spaceDTO.setSettlementMethod(methodDTO.getSettlementMethod());
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "广告位不能删除!"); spaceDTO.setSettlementMethodName(SettlementMethodEnum.getNameByCode(methodDTO.getSettlementMethod()));
} else { spaceDTO.setPriceEachTime(methodDTO.getPriceEachTime());
}
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("adId", advertisingSpace.getId()); paramMap.put("adId", adId);
Boolean hasBook = (Boolean) advertisingDistributionBookDao.getBy(paramMap, "checkAdSpaceHasBook"); Integer bookNum = (Integer) advertisingDistributionBookDao.getBy(paramMap, "countByAdId");
if (null != hasBook && hasBook) { spaceDTO.setBookNum(bookNum);
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "广告位不能删除!"); // 填充广告位置名称
if (AdPositionEnum.WECHAT_GROUP_MSG.positionCode.equals(spaceDTO.getAdPosition())) {
fillAdpositionName4WechatGroupAd(spaceDTO);
} else {
fillAdpositionName4CommonAd(spaceDTO);
} }
} }
advertisingSpaceDao.deleteById(advertisingSpace.getId()); return spaceDTO;
} }
/** /**
* 获取广告位信息 * 投放书刊
*/ */
@Override @Override
@ParamLog(value = "获取广告位信息") @Transactional(rollbackFor = Exception.class)
public AdvertisingSpaceDTO get(Long adId) throws BizException { @ParamLog(value = "投放书刊", isAfterReturn = false)
return advertisingSpaceDao.getDTOById(adId); public void distributeBook(AdvertisingDistributionBook book) throws BizException {
if (null == book.getAdId() || ListUtils.isEmpty(book.getBooks()) || null == book.getIsBookGroup()) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!");
}
AdvertisingSpace advertisingSpace = advertisingSpaceDao.getById(book.getAdId());
if (null == advertisingSpace || !advertisingSpace.getIsOpen()) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "广告位不存在或已关闭!");
}
AdvertisingSpace space = new AdvertisingSpace();
space.setId(book.getAdId());
advertisingSpaceDao.update(space);
boolean paramError = book.getBooks().stream().anyMatch(bookAdviser -> null == bookAdviser.getBookId()
|| null == bookAdviser.getChannelId() || null == bookAdviser.getAdviserId());
if (paramError) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!");
}
// 校验书刊是否已投广告位
Map<String, Object> paramMap = new HashMap<>();
if (book.getIsBookGroup()) {
// 社群书
for (BookAdviser bookAdviser : book.getBooks()) {
paramMap.put("adPositionDetail", advertisingSpace.getAdPositionDetail());
paramMap.put("bookId", bookAdviser.getBookId());
paramMap.put("channelId", bookAdviser.getChannelId());
Integer existCount = (Integer) advertisingDistributionBookDao.getBy(paramMap, "checkBookGroupAdExist");
if (null != existCount && existCount > 0) {
BookDto bookDto = bookBiz.getBaseById(bookAdviser.getBookId());
throw new BookBizException(BookBizException.PARAM_IS_ERROR, StringUtil.addBracket(bookDto.getBookName()) + "等社群书"
+ AdPositionDetailEnum.getNameByCode(advertisingSpace.getAdPositionDetail()) + "已投放广告位!");
}
}
} else {
// 非社群书
paramMap.put("adPositionDetail", advertisingSpace.getAdPositionDetail());
paramMap.put("adPositionMode", advertisingSpace.getAdPositionMode());
for (BookAdviser bookAdviser : book.getBooks()) {
paramMap.put("bookId", bookAdviser.getBookId());
paramMap.put("channelId", bookAdviser.getChannelId());
Integer existCount = (Integer) advertisingDistributionBookDao.getBy(paramMap, "checkBookAdExist");
if (null != existCount && existCount > 0) {
BookDto bookDto = bookBiz.getBaseById(bookAdviser.getBookId());
throw new BookBizException(BookBizException.PARAM_IS_ERROR, StringUtil.addBracket(bookDto.getBookName()) + "等书已投放该广告位!");
}
}
}
List<AdvertisingDistributionBook> list = new ArrayList<>();
for (BookAdviser bookAdviser : book.getBooks()) {
AdvertisingDistributionBook distributionBook = new AdvertisingDistributionBook();
distributionBook.setAdId(book.getAdId());
distributionBook.setBookId(bookAdviser.getBookId());
distributionBook.setChannelId(bookAdviser.getChannelId());
distributionBook.setAdviserId(bookAdviser.getAdviserId());
Long agentId = adviserConsr.getAgentIdByAdviser(bookAdviser.getAdviserId());
distributionBook.setAgentId(agentId);
distributionBook.setIsBookGroup(book.getIsBookGroup());
list.add(distributionBook);
}
advertisingDistributionBookDao.batchInsert(list);
} }
/** /**
* 投放书刊 * 投放微信群
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ParamLog(value = "投放书刊", isAfterReturn = false) @ParamLog(value = "投放微信群", isAfterReturn = false)
public void distributeBook(AdvertisingDistributionBook book) throws BizException { public void distributeWechatGroup(AdvertisingDistributionBook book) throws BizException {
if (null == book.getAdId() || null == book.getDistributionType() if (null == book.getAdId() || ListUtils.isEmpty(book.getGroups())) {
|| !ArrayUtils.contains(DistributionTypeEnum.DISTRIBUTION_TYPE_GATHER, book.getDistributionType())
|| (DistributionTypeEnum.SIGN_BOOK.value.equals(book.getDistributionType()) && (ListUtils.isEmpty(book.getBooks()) || null == book.getAdviserId()))) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!");
} }
if (DistributionTypeEnum.NO_SIGN_BOOK.value.equals(book.getDistributionType())) { AdvertisingSpace advertisingSpace = advertisingSpaceDao.getById(book.getAdId());
Map<String, Object> paramMap = new HashMap<>(); if (null == advertisingSpace) {
paramMap.put("adId", book.getAdId()); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "广告位不存在!");
AdvertisingSpaceDTO spaceDTO = (AdvertisingSpaceDTO) advertisingSpaceDao.getBy(paramMap, "getNoSignBookAd"); }
if (null != spaceDTO) { if (!AdPositionEnum.WECHAT_GROUP_MSG.positionCode.equals(advertisingSpace.getAdPosition())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "只能创建一个不指定书刊的广告位!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "该广告位不能投放到微信群!");
}
} }
AdvertisingSpace space = new AdvertisingSpace(); AdvertisingSpace space = new AdvertisingSpace();
space.setId(book.getAdId()); space.setId(book.getAdId());
space.setDistributionType(book.getDistributionType());
advertisingSpaceDao.update(space); advertisingSpaceDao.update(space);
if (DistributionTypeEnum.SIGN_BOOK.value.equals(book.getDistributionType())) { boolean paramError = book.getGroups().stream().anyMatch(group -> null == group.getBookId()
boolean paramError = book.getBooks().stream().anyMatch(bookAdviser -> null == bookAdviser.getBookId() || null == bookAdviser.getChannelId()); || null == group.getChannelId() || null == group.getAdviserId() || null == group.getClassifyId() || null == group.getQrcodeId());
if (paramError) { if (paramError) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!");
} }
List<Long> bookIds = book.getBooks().stream().map(BookAdviser::getBookId).collect(Collectors.toList()); // 校验广告位是否已投放微信群
List<Long> existIds = advertisingDistributionBookDao.checkBookIdExist(bookIds); List<Long> qrcodeIds = book.getGroups().stream().map(DistributionWechatGroup::getQrcodeId).collect(Collectors.toList());
if (!ListUtils.isEmpty(existIds)) { Map<String, Object> paramMap = new HashMap<>();
Long bookId = existIds.get(0); paramMap.put("adId", book.getAdId());
BookDto bookDto = bookBiz.getBaseById(bookId); paramMap.put("qrcodeIds", qrcodeIds);
throw new BookBizException(BookBizException.PARAM_IS_ERROR, StringUtil.addBracket(bookDto.getBookName()) + "等" + existIds.size() + "本书已投放广告位!"); List<Long> existIds = advertisingDistributionBookDao.checkQrcodeIdExist(paramMap);
if (!ListUtils.isEmpty(existIds)) {
Long qrcodeId = existIds.get(0);
GroupQrcode groupQrcode = groupQrcodeDao.getById(qrcodeId);
throw new BookBizException(BookBizException.PARAM_IS_ERROR, StringUtil.addBracket(groupQrcode.getGroupName()) + "等" + existIds.size() + "个微信群已投放该广告位!");
}
List<AdvertisingDistributionBook> list = new ArrayList<>();
Map<Long, Long> agentIdMap = new HashMap<>();
for (DistributionWechatGroup group : book.getGroups()) {
AdvertisingDistributionBook distributionBook = new AdvertisingDistributionBook();
distributionBook.setAdId(book.getAdId());
distributionBook.setBookId(group.getBookId());
distributionBook.setChannelId(group.getChannelId());
distributionBook.setAdviserId(group.getAdviserId());
distributionBook.setClassifyId(group.getClassifyId());
distributionBook.setQrcodeId(group.getQrcodeId());
Long agentId;
if (!agentIdMap.containsKey(group.getAdviserId())) {
agentId = adviserConsr.getAgentIdByAdviser(group.getAdviserId());
agentIdMap.put(group.getAdviserId(), agentId);
} else {
agentId = agentIdMap.get(group.getAdviserId());
} }
List<AdvertisingDistributionBook> list = new ArrayList<>(); distributionBook.setAgentId(agentId);
Long agentId = adviserConsr.getAgentIdByAdviser(book.getAdviserId()); distributionBook.setIsBookGroup(true);
for (BookAdviser bookAdviser : book.getBooks()) { list.add(distributionBook);
AdvertisingDistributionBook distributionBook = new AdvertisingDistributionBook(); }
distributionBook.setAdId(book.getAdId()); advertisingDistributionBookDao.batchInsert(list);
distributionBook.setBookId(bookAdviser.getBookId()); for (DistributionWechatGroup group : book.getGroups()) {
distributionBook.setChannelId(bookAdviser.getChannelId()); // 获取群信息
distributionBook.setAdviserId(book.getAdviserId()); GroupQrcode groupQrcode = groupQrcodeDao.getById(group.getQrcodeId());
distributionBook.setAgentId(agentId); String groupId = groupQrcode.getWeixinGroupId();
list.add(distributionBook); ClassifyDTO classifyDTO = bookGroupClassifyDao.getById(group.getClassifyId());
// 获取机器人微信号
String altId = wechatGroupConsr.getRobotIdByGroupId(groupId);
if (AdPositionModeEnum.TEXT_AND_LINK.modeCode.equals(advertisingSpace.getAdPositionMode())) {
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
sendTextMessageVO.setGroupId(groupId);
sendTextMessageVO.setAltId(altId);
String adLink = "";
if (!StringUtil.isEmpty(advertisingSpace.getAdLink())) {
if (advertisingSpace.getAdLink().contains("?")) {
adLink = advertisingSpace.getAdLink() + "&book_group_id=" + classifyDTO.getBookGroupId() + "&classify_id=" + group.getClassifyId()
+ "&qrcode_id=" + group.getQrcodeId() + "&ad_id=" + advertisingSpace.getId();
} else {
adLink = advertisingSpace.getAdLink() + "?book_group_id=" + classifyDTO.getBookGroupId() + "&classify_id=" + group.getClassifyId()
+ "&qrcode_id=" + group.getQrcodeId() + "&ad_id=" + advertisingSpace.getId();
}
adLink = UrlUtils.getShortUrl4Own(wechatGroupLinkPrefix + "/link?url=" + URLEncoder.encode(adLink));
}
sendTextMessageVO.setContent(advertisingSpace.getAdTitle() + "\n" + adLink);
WxGroupSDK.sendTextMessage(sendTextMessageVO);
} else if (AdPositionModeEnum.NEWS_SHARE.modeCode.equals(advertisingSpace.getAdPositionMode())) {
SendArticleMessageVO sendArticleMessageVO = new SendArticleMessageVO();
sendArticleMessageVO.setAltId(altId);
sendArticleMessageVO.setTitle(advertisingSpace.getAdTitle());
sendArticleMessageVO.setDescription(advertisingSpace.getAdSlogan());
sendArticleMessageVO.setGroupId(groupId);
String adLink = "";
if (!StringUtil.isEmpty(advertisingSpace.getAdLink())) {
if (advertisingSpace.getAdLink().contains("?")) {
adLink = advertisingSpace.getAdLink() + "&book_group_id=" + classifyDTO.getBookGroupId() + "&classify_id=" + group.getClassifyId()
+ "&qrcode_id=" + group.getQrcodeId() + "&ad_id=" + advertisingSpace.getId();
} else {
adLink = advertisingSpace.getAdLink() + "?book_group_id=" + classifyDTO.getBookGroupId() + "&classify_id=" + group.getClassifyId()
+ "&qrcode_id=" + group.getQrcodeId() + "&ad_id=" + advertisingSpace.getId();
}
}
sendArticleMessageVO.setLinkUrl(adLink);
sendArticleMessageVO.setPicUrl(advertisingSpace.getAdPic());
WxGroupSDK.sendArticleMessage(sendArticleMessageVO);
} else if (AdPositionModeEnum.JUST_PIC.modeCode.equals(advertisingSpace.getAdPositionMode())) {
SendPicMessageVO sendPicMessageVO = new SendPicMessageVO();
sendPicMessageVO.setAltId(altId);
sendPicMessageVO.setGroupId(groupId);
sendPicMessageVO.setPicUrl(advertisingSpace.getAdPic());
WxGroupSDK.sendPicMessage(sendPicMessageVO);
}
}
// 根据微信群人数埋点
Map<Long, GroupQrcodeInfoDTO> map = groupQrcodeDao.listQrcodeInfoByIds(qrcodeIds);
if (!MapUtils.isEmpty(map)) {
List<AdvertisingExposureRecord> recordList = new ArrayList<>();
for (DistributionWechatGroup group : book.getGroups()) {
Long qrcodeId = group.getQrcodeId();
if (map.containsKey(qrcodeId)) {
GroupQrcodeInfoDTO dto = map.get(qrcodeId);
Integer userNumber = dto.getUserNumber();
AdvertisingExposureRecord record = new AdvertisingExposureRecord();
record.setAdId(book.getAdId());
record.setBookId(group.getBookId());
record.setIsBookGroup(true);
record.setAdviserId(group.getAdviserId());
record.setAgentId(agentIdMap.get(group.getAdviserId()));
record.setChannelId(group.getChannelId());
record.setFromType("WECHAT_GROUP");
record.setFromId(qrcodeId);
record.setCount(userNumber.longValue());
recordList.add(record);
}
}
if (!ListUtils.isEmpty(recordList)) {
advertisingExposureRecordDao.insert(recordList);
} }
advertisingDistributionBookDao.batchInsert(list);
} }
} }
...@@ -336,8 +589,6 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz { ...@@ -336,8 +589,6 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
*/ */
@Override @Override
public PageBean listBook4Platform(Map<String, Object> paramMap, PageParam pageParam, Long adviserId) throws BizException { public PageBean listBook4Platform(Map<String, Object> paramMap, PageParam pageParam, Long adviserId) throws BizException {
Long agentId = adviserConsr.getAgentIdByAdviser(adviserId);
paramMap.put("agentId", agentId);
PageBean pageBean = bookDao.listPage(pageParam, paramMap, "listBook4Platform"); PageBean pageBean = bookDao.listPage(pageParam, paramMap, "listBook4Platform");
if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) { if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) {
return new PageBean(0, 0, new ArrayList<>()); return new PageBean(0, 0, new ArrayList<>());
...@@ -346,6 +597,18 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz { ...@@ -346,6 +597,18 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
} }
/** /**
* 平台端获取社群书微信群列表
*/
@Override
public PageBean listGroupQrcode4Platform(Map<String, Object> paramMap, PageParam pageParam) throws BizException {
PageBean pageBean = bookGroupClassifyDao.listPage(pageParam, paramMap, "listGroupQrcode4Platform");
if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) {
return new PageBean(0, 0, new ArrayList<>());
}
return pageBean;
}
/**
* 获取广告位投放书刊列表 * 获取广告位投放书刊列表
*/ */
@Override @Override
...@@ -357,12 +620,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz { ...@@ -357,12 +620,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("adId", adId); paramMap.put("adId", adId);
paramMap.put("name", StringUtil.isEmpty(name) ? null : name); paramMap.put("name", StringUtil.isEmpty(name) ? null : name);
PageBean pageBean; PageBean pageBean = bookDao.listPage(pageParam, paramMap, "listBook4AdvertisingSpace");
if (DistributionTypeEnum.SIGN_BOOK.value.equals(space.getDistributionType())) {
pageBean = bookDao.listPage(pageParam, paramMap, "listBook4AdvertisingSpace");
} else {
pageBean = bookDao.listPage(pageParam, paramMap, "listBook4AdvertisingSpaceNoSignBook");
}
if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) { if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) {
return new PageBean(0, 0, new ArrayList<>()); return new PageBean(0, 0, new ArrayList<>());
} }
...@@ -370,114 +628,234 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz { ...@@ -370,114 +628,234 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
bookSet.setAdviserName4BookDto(pageBean.getRecordList()); bookSet.setAdviserName4BookDto(pageBean.getRecordList());
// 设置出版名称 // 设置出版名称
bookSet.setAgentName4BookDto(pageBean.getRecordList()); bookSet.setAgentName4BookDto(pageBean.getRecordList());
// 填充渠道公众号信息
bookSet.setChannelOfficialAccountInfoList(pageBean.getRecordList());
for (Object object : pageBean.getRecordList()) { for (Object object : pageBean.getRecordList()) {
BookDto bookDto = (BookDto) object; BookDto bookDto = (BookDto) object;
if (!DistributionTypeEnum.SIGN_BOOK.value.equals(space.getDistributionType())) {
bookDto.setDistributionTime(space.getCreateTime());
}
// 曝光量 // 曝光量
Long exposureNum = getExposureNumByBookId(adId, bookDto.getBookId(), bookDto.getAdviserId(), bookDto.getChannelId()); Long exposureNum = getExposureNumByAdId(adId, bookDto.getBookId(), bookDto.getAdviserId(), bookDto.getChannelId(), null);
bookDto.setExposureNum(exposureNum); bookDto.setExposureNum(exposureNum);
// 点击量 // 点击量
Long clickNum = getClickNumByBookId(adId, bookDto.getBookId(), bookDto.getAdviserId(), bookDto.getChannelId()); Long clickNum = getClickNumByAdId(adId, bookDto.getBookId(), bookDto.getAdviserId(), bookDto.getChannelId(), null);
bookDto.setClickNum(clickNum); bookDto.setClickNum(clickNum);
BigDecimal clickRate = (null == bookDto.getExposureNum() || bookDto.getExposureNum().equals(0L)) ? BigDecimal.ZERO :
new BigDecimal(bookDto.getClickNum().doubleValue() / bookDto.getExposureNum()).setScale(2, BigDecimal.ROUND_HALF_UP);
bookDto.setClickRate(clickRate);
BigDecimal income = getIncomeByAdId(adId, bookDto.getBookId(), bookDto.getChannelId(), null);
bookDto.setTotalIncome(income);
} }
return pageBean; return pageBean;
} }
/** /**
* 获取广告位投放作品/应用数据统计 * 获取广告位投放微信群列表
*/ */
@Override @Override
public PageBean distributionAppStatics(Long adId, PageParam pageParam) throws BizException { public PageBean distributionWechatGroupList(Long adId, String name, PageParam pageParam) throws BizException {
AdvertisingSpace space = advertisingSpaceDao.getById(adId); AdvertisingSpace space = advertisingSpaceDao.getById(adId);
if (null == space) { if (null == space) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "广告位不存在或已删除!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "广告位不存在或已删除!");
} }
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("adId", adId); paramMap.put("adId", adId);
PageBean pageBean = advertisingExposureRecordDao.listPage(pageParam, paramMap, "distributionAppStatics"); paramMap.put("name", StringUtil.isEmpty(name) ? null : name);
PageBean pageBean = advertisingDistributionBookDao.listPage(pageParam, paramMap, "distributionWechatGroupList");
if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) { if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) {
return new PageBean(0, 0, new ArrayList<>()); return new PageBean(0, 0, new ArrayList<>());
} }
List<Long> productIds = new ArrayList<>(); List<Long> adviserIds = new ArrayList<>();
List<Long> appIds = new ArrayList<>(); List<Long> agentIds = new ArrayList<>();
pageBean.getRecordList().forEach(obj -> {
adviserIds.add(((AdGroupQrcodeDTO) obj).getAdviserId());
agentIds.add(((AdGroupQrcodeDTO) obj).getAgentId());
});
Map<Long, String> adviserNameMap = adviserConsr.getNames(new ArrayList<>(new HashSet<>(adviserIds)));
Map<Long, String> agentNameMap = agentConsr.getNames(new ArrayList<>(new HashSet<>(agentIds)));
for (Object object : pageBean.getRecordList()) { for (Object object : pageBean.getRecordList()) {
DistributionAppDTO dto = (DistributionAppDTO) object; AdGroupQrcodeDTO qrcodeDTO = (AdGroupQrcodeDTO) object;
if ("PRODUCT".equals(dto.getFromType())) { if (!MapUtils.isEmpty(adviserNameMap) && adviserNameMap.containsKey(qrcodeDTO.getAdviserId())) {
productIds.add(dto.getFromId()); qrcodeDTO.setAdviserName(adviserNameMap.get(qrcodeDTO.getAdviserId()));
} else if ("APP".equals(dto.getFromType())) { }
appIds.add(dto.getFromId()); if (!MapUtils.isEmpty(agentNameMap) && agentNameMap.containsKey(qrcodeDTO.getAgentId())) {
qrcodeDTO.setAgentName(agentNameMap.get(qrcodeDTO.getAgentId()));
} }
// 曝光量
Long exposureNum = getExposureNumByGroupQrcodeId(qrcodeDTO.getGroupQrcodeId(), adId, null);
qrcodeDTO.setExposureNum(exposureNum);
// 点击量
Long clickNum = getClickNumByGroupQrcodeId(qrcodeDTO.getGroupQrcodeId(), adId, null);
qrcodeDTO.setClickNum(clickNum);
BigDecimal clickRate = (null == qrcodeDTO.getExposureNum() || qrcodeDTO.getExposureNum().equals(0L)) ? BigDecimal.ZERO :
new BigDecimal(qrcodeDTO.getClickNum().doubleValue() / qrcodeDTO.getExposureNum()).setScale(2, BigDecimal.ROUND_HALF_UP);
qrcodeDTO.setClickRate(clickRate);
BigDecimal income = getIncomeByGroupQrcodeId(qrcodeDTO.getGroupQrcodeId(), adId, null);
qrcodeDTO.setTotalIncome(income);
// 点击读者量
Long clickUserNum = getClickUserNumByGroupQrcodeId(qrcodeDTO.getGroupQrcodeId(), adId, null);
qrcodeDTO.setClickUserNum(clickUserNum);
}
return pageBean;
}
/**
* 获取广告位投放书刊列表
*/
@Override
public PageBean advertisingBookList(String name, PageParam pageParam) throws BizException {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("name", StringUtil.isEmpty(name) ? null : name);
PageBean pageBean = bookDao.listPage(pageParam, paramMap, "advertisingBookList");
if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) {
return new PageBean(0, 0, new ArrayList<>());
} }
Map<Long, Product4BookDTO> productMap = productConsr.getProBasesWithSceneByIds(productIds); // 设置编辑名称
Map<Long, AppDto> appMap = appConsr.getBaseByIds(appIds); bookSet.setAdviserName4BookDto(pageBean.getRecordList());
// 设置出版名称
bookSet.setAgentName4BookDto(pageBean.getRecordList());
for (Object object : pageBean.getRecordList()) { for (Object object : pageBean.getRecordList()) {
DistributionAppDTO dto = (DistributionAppDTO) object; BookDto bookDto = (BookDto) object;
if ("PRODUCT".equals(dto.getFromType()) && !MapUtils.isEmpty(productMap) && productMap.containsKey(dto.getFromId())) { // 曝光量
Product4BookDTO product4BookDTO = productMap.get(dto.getFromId()); Long exposureNum = getExposureNumByBookId(bookDto.getBookId(), bookDto.getAdviserId(), bookDto.getChannelId());
dto.setTitle(product4BookDTO.getProductName()); bookDto.setExposureNum(exposureNum);
dto.setSceneCode(product4BookDTO.getProductSceneCode()); // 点击量
dto.setSceneName(product4BookDTO.getProductSceneName()); Long clickNum = getClickNumByBookId(bookDto.getBookId(), bookDto.getAdviserId(), bookDto.getChannelId());
dto.setCreateUser(product4BookDTO.getMerchantId()); bookDto.setClickNum(clickNum);
dto.setCreateUserName(product4BookDTO.getMerchantName()); BigDecimal clickRate = (null == bookDto.getExposureNum() || bookDto.getExposureNum().equals(0L)) ? BigDecimal.ZERO :
dto.setCreateRole(product4BookDTO.getIsSuperMerchant() ? "超级作者" : "普通作者"); new BigDecimal(bookDto.getClickNum().doubleValue() / bookDto.getExposureNum()).setScale(2, BigDecimal.ROUND_HALF_UP);
} else if ("APP".equals(dto.getFromType()) && !MapUtils.isEmpty(appMap) && appMap.containsKey(dto.getFromId())) { bookDto.setClickRate(clickRate);
AppDto appDto = appMap.get(dto.getFromId()); BigDecimal income = getIncomeByBookId(bookDto.getBookId(), bookDto.getChannelId());
dto.setTitle(appDto.getTitle()); bookDto.setTotalIncome(income);
dto.setSceneCode(appDto.getSceneCode());
dto.setSceneName(appDto.getSceneName());
dto.setCreateUser(appDto.getCreatedUser());
dto.setCreateUserName(appDto.getAdviserName());
dto.setCreateRole("编辑");
}
} }
return pageBean; return pageBean;
} }
/** /**
* 获取广告位投放时间统计 * 获取广告位投放微信群列表
*/ */
@Override @Override
@ParamLog("获取广告位投放时间统计") public PageBean advertisingWechatGroupList(String name, PageParam pageParam) throws BizException {
public List<Object> distributionDateStatics(Long adId, Integer day) throws BizException {
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("adId", adId); paramMap.put("name", StringUtil.isEmpty(name) ? null : name);
Date startTime = DateUtils.addDay(new Date(), -day); PageBean pageBean = bookGroupClassifyDao.listPage(pageParam, paramMap, "advertisingWechatGroupList");
Date endTime = DateUtils.addDay(new Date(), -1); if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) {
paramMap.put("collectDates", CommonUtils.collectLocalDates(startTime, endTime)); return new PageBean(0, 0, new ArrayList<>());
return advertisingExposureRecordDao.listBy(paramMap, "distributionDateStatics"); }
for (Object object : pageBean.getRecordList()) {
AdGroupQrcodeDTO qrcodeDTO = (AdGroupQrcodeDTO) object;
// 曝光量
Long exposureNum = getExposureNumByGroupQrcodeId(qrcodeDTO.getGroupQrcodeId(), null, null);
qrcodeDTO.setExposureNum(exposureNum);
// 点击量
Long clickNum = getClickNumByGroupQrcodeId(qrcodeDTO.getGroupQrcodeId(), null, null);
qrcodeDTO.setClickNum(clickNum);
BigDecimal clickRate = (null == qrcodeDTO.getExposureNum() || qrcodeDTO.getExposureNum().equals(0L)) ? BigDecimal.ZERO :
new BigDecimal(qrcodeDTO.getClickNum().doubleValue() / qrcodeDTO.getExposureNum()).setScale(2, BigDecimal.ROUND_HALF_UP);
qrcodeDTO.setClickRate(clickRate);
BigDecimal income = getIncomeByGroupQrcodeId(qrcodeDTO.getGroupQrcodeId(), null, null);
qrcodeDTO.setTotalIncome(income);
// 点击读者量
Long clickUserNum = getClickUserNumByGroupQrcodeId(qrcodeDTO.getGroupQrcodeId(), null, null);
qrcodeDTO.setClickUserNum(clickUserNum);
}
return pageBean;
}
/**
* 获取广告位投放微信群曝光量前几位
*/
@Override
public List<AdGroupQrcodeDTO> advertisingWechatGroupRankTop() throws BizException {
List<AdGroupQrcodeDTO> list = advertisingExposureRecordDao.advertisingWechatGroupRankTop();
return list;
} }
/** /**
* 获取书刊广告位曝光量 * 获取书刊广告位曝光量
*/ */
private Long getExposureNumByBookId(Long adId, Long bookId, Long adviserId, Long channelId) { private Long getExposureNumByAdId(Long adId, Long bookId, Long adviserId, Long channelId, String statisMonth) {
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("adId", adId); paramMap.put("adId", adId);
paramMap.put("bookId", bookId); paramMap.put("bookId", bookId);
paramMap.put("adviserId", adviserId); paramMap.put("adviserId", adviserId);
paramMap.put("channelId", channelId); paramMap.put("channelId", channelId);
paramMap.put("statisMonth", statisMonth);
Long exposureNum = (Long) advertisingExposureRecordDao.getBy(paramMap, "getExposureNum"); Long exposureNum = (Long) advertisingExposureRecordDao.getBy(paramMap, "getExposureNum");
return null == exposureNum ? 0L : exposureNum; return null == exposureNum ? 0L : exposureNum;
} }
/** /**
* 获取书刊广告位曝光量
*/
private Long getExposureNumByBookId(Long bookId, Long adviserId, Long channelId) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookId", bookId);
paramMap.put("adviserId", adviserId);
paramMap.put("channelId", channelId);
Long exposureNum = (Long) advertisingExposureRecordDao.getBy(paramMap, "getExposureNumByBookId");
return null == exposureNum ? 0L : exposureNum;
}
/**
* 获取书刊广告位曝光量
*/
private Long getExposureNumByGroupQrcodeId(Long qrcodeId, Long adId, String statisMonth) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("qrcodeId", qrcodeId);
paramMap.put("adId", adId);
paramMap.put("statisMonth", statisMonth);
Long exposureNum = (Long) advertisingExposureRecordDao.getBy(paramMap, "getExposureNumByGroupQrcodeId");
return null == exposureNum ? 0L : exposureNum;
}
/**
* 获取书刊广告位点击量 * 获取书刊广告位点击量
*/ */
private Long getClickNumByBookId(Long adId, Long bookId, Long adviserId, Long channelId) { private Long getClickNumByAdId(Long adId, Long bookId, Long adviserId, Long channelId, String statisMonth) {
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("adId", adId); paramMap.put("adId", adId);
paramMap.put("bookId", bookId); paramMap.put("bookId", bookId);
paramMap.put("adviserId", adviserId); paramMap.put("adviserId", adviserId);
paramMap.put("channelId", channelId); paramMap.put("channelId", channelId);
paramMap.put("statisMonth", statisMonth);
Long clickNum = (Long) advertisingClickRecordDao.getBy(paramMap, "getClickNum"); Long clickNum = (Long) advertisingClickRecordDao.getBy(paramMap, "getClickNum");
return null == clickNum ? 0L : clickNum; return null == clickNum ? 0L : clickNum;
} }
/** /**
* 获取书刊广告位点击量
*/
private Long getClickNumByBookId(Long bookId, Long adviserId, Long channelId) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookId", bookId);
paramMap.put("adviserId", adviserId);
paramMap.put("channelId", channelId);
Long clickNum = (Long) advertisingClickRecordDao.getBy(paramMap, "getClickNumByBookId");
return null == clickNum ? 0L : clickNum;
}
/**
* 获取书刊广告位点击量
*/
private Long getClickNumByGroupQrcodeId(Long qrcodeId, Long adId, String statisMonth) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("qrcodeId", qrcodeId);
paramMap.put("adId", adId);
paramMap.put("statisMonth", statisMonth);
Long clickNum = (Long) advertisingClickRecordDao.getBy(paramMap, "getClickNumByGroupQrcodeId");
return null == clickNum ? 0L : clickNum;
}
/**
* 获取书刊广告位点击读者量
*/
private Long getClickUserNumByGroupQrcodeId(Long qrcodeId, Long adId, String statisMonth) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("qrcodeId", qrcodeId);
paramMap.put("adId", adId);
paramMap.put("statisMonth", statisMonth);
Long clickUserNum = (Long) advertisingClickRecordDao.getBy(paramMap, "getClickUserNumByGroupQrcodeId");
return null == clickUserNum ? 0L : clickUserNum;
}
/**
* 获取书刊广告位曝光量 * 获取书刊广告位曝光量
*/ */
private Long getExposureNumByAdId(Long adId) { private Long getExposureNumByAdId(Long adId) {
...@@ -488,6 +866,16 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz { ...@@ -488,6 +866,16 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
} }
/** /**
* 获取书刊广告位曝光量
*/
private Long getExposureNumByMasterId(Long masterId) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("masterId", masterId);
Long exposureNum = (Long) advertisingExposureRecordDao.getBy(paramMap, "getExposureNumByMasterId");
return null == exposureNum ? 0L : exposureNum;
}
/**
* 获取书刊广告位点击量 * 获取书刊广告位点击量
*/ */
private Long getClickNumByAdId(Long adId) { private Long getClickNumByAdId(Long adId) {
...@@ -498,10 +886,75 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz { ...@@ -498,10 +886,75 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
} }
/** /**
* 获取书刊广告位点击量
*/
private Long getClickNumByMasterId(Long masterId) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("masterId", masterId);
Long clickNum = (Long) advertisingClickRecordDao.getBy(paramMap, "getClickNumByMasterId");
return null == clickNum ? 0L : clickNum;
}
/**
* 获取书刊广告位收益
*/
private BigDecimal getIncomeByAdId(Long adId) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("adId", adId);
BigDecimal income = (BigDecimal) advertisingIncomeDailyDao.getBy(paramMap, "getIncomeByAdId");
return null == income ? BigDecimal.ZERO : income;
}
/**
* 获取书刊广告位收益
*/
private BigDecimal getIncomeByMasterId(Long masterId) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("masterId", masterId);
BigDecimal income = (BigDecimal) advertisingIncomeDailyDao.getBy(paramMap, "getIncomeByMasterId");
return null == income ? BigDecimal.ZERO : income;
}
/**
* 获取书刊广告位收益
*/
private BigDecimal getIncomeByAdId(Long adId, Long bookId, Long channelId, String statisMonth) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("adId", adId);
paramMap.put("bookId", bookId);
paramMap.put("channelId", channelId);
paramMap.put("statisMonth", statisMonth);
BigDecimal income = (BigDecimal) advertisingIncomeDailyDao.getBy(paramMap, "getIncomeByAdId");
return null == income ? BigDecimal.ZERO : income;
}
/**
* 获取书刊广告位点击量
*/
private BigDecimal getIncomeByBookId(Long bookId, Long channelId) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookId", bookId);
paramMap.put("channelId", channelId);
BigDecimal income = (BigDecimal) advertisingIncomeDailyDao.getBy(paramMap, "getIncomeByBookId");
return null == income ? BigDecimal.ZERO : income;
}
/**
* 获取书刊广告位收益
*/
private BigDecimal getIncomeByGroupQrcodeId(Long qrcodeId, Long adId, String statisMonth) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("qrcodeId", qrcodeId);
paramMap.put("adId", adId);
paramMap.put("statisMonth", statisMonth);
BigDecimal income = (BigDecimal) advertisingIncomeDailyDao.getBy(paramMap, "getIncomeByGroupQrcodeId");
return null == income ? BigDecimal.ZERO : income;
}
/**
* 获取广告位列表 * 获取广告位列表
*/ */
@Override @Override
@ParamLog("获取广告位列表")
public PageBean list(String name, PageParam pageParam) throws BizException { public PageBean list(String name, PageParam pageParam) throws BizException {
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("name", StringUtil.isEmpty(name) ? null : name); paramMap.put("name", StringUtil.isEmpty(name) ? null : name);
...@@ -509,23 +962,397 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz { ...@@ -509,23 +962,397 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) { if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) {
return new PageBean(0, 0, new ArrayList<>()); return new PageBean(0, 0, new ArrayList<>());
} }
// 填充投放书籍 // 填充投放数据
for (Object object : pageBean.getRecordList()) { for (Object object : pageBean.getRecordList()) {
AdvertisingSpaceDTO spaceDTO = (AdvertisingSpaceDTO) object; AdvertisingSpaceDTO spaceDTO = (AdvertisingSpaceDTO) object;
if (null == spaceDTO) { if (null == spaceDTO) {
continue; continue;
} }
AdvertisingMaster master = advertisingMasterDao.getById(spaceDTO.getMasterId());
if (null != master) {
spaceDTO.setMasterName(master.getMasterName());
}
spaceDTO.setExposureNum(getExposureNumByAdId(spaceDTO.getId())); spaceDTO.setExposureNum(getExposureNumByAdId(spaceDTO.getId()));
spaceDTO.setClickNum(getClickNumByAdId(spaceDTO.getId())); spaceDTO.setClickNum(getClickNumByAdId(spaceDTO.getId()));
if (DistributionTypeEnum.SIGN_BOOK.value.equals(spaceDTO.getDistributionType())) { BigDecimal clickRate = (null == spaceDTO.getExposureNum() || spaceDTO.getExposureNum().equals(0L)) ? BigDecimal.ZERO :
List<AdvertisingDistributionBook> list = advertisingDistributionBookDao.getByAdId(spaceDTO.getId()); new BigDecimal(spaceDTO.getClickNum().doubleValue() / spaceDTO.getExposureNum()).setScale(2, BigDecimal.ROUND_HALF_UP);
if (!ListUtils.isEmpty(list)) { spaceDTO.setClickRate(clickRate);
spaceDTO.setBookNum(list.size()); BigDecimal income = getIncomeByAdId(spaceDTO.getId());
Long bookId = list.get(0).getBookId(); spaceDTO.setTotalIncome(income);
BookDto bookDto = bookBiz.getBaseById(bookId); List<AdvertisingDistributionBook> list = advertisingDistributionBookDao.getByAdId(spaceDTO.getId());
if (!ListUtils.isEmpty(list)) {
spaceDTO.setBookNum(list.size());
Long bookId = list.get(0).getBookId();
BookDto bookDto = bookBiz.getBaseById(bookId);
spaceDTO.setBookName(StringUtil.addBracket(bookDto.getBookName()));
} else {
spaceDTO.setBookNum(0);
}
// 填充广告位置名称
if (AdPositionEnum.WECHAT_GROUP_MSG.positionCode.equals(spaceDTO.getAdPosition())) {
fillAdpositionName4WechatGroupAd(spaceDTO);
} else {
fillAdpositionName4CommonAd(spaceDTO);
}
}
return pageBean;
}
/**
* 书刊广告位明细
*/
@Override
public PageBean advertisingDetail4Book(Long bookId, Long channelId, Long adviserId, String statisMonth, PageParam pageParam) throws BizException {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookId", bookId);
paramMap.put("channelId", channelId);
paramMap.put("adviserId", adviserId);
PageBean pageBean = advertisingSpaceDao.listPage(pageParam, paramMap, "advertisingDetail4Book");
if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) {
return new PageBean(0, 0, new ArrayList<>());
}
// 填充投放数据
for (Object object : pageBean.getRecordList()) {
AdvertisingSpaceDTO spaceDTO = (AdvertisingSpaceDTO) object;
if (null == spaceDTO) {
continue;
}
AdvertisingMaster master = advertisingMasterDao.getById(spaceDTO.getMasterId());
if (null != master) {
spaceDTO.setMasterName(master.getMasterName());
}
spaceDTO.setExposureNum(getExposureNumByAdId(spaceDTO.getId(), bookId, adviserId, channelId, statisMonth));
spaceDTO.setClickNum(getClickNumByAdId(spaceDTO.getId(), bookId, adviserId, channelId, statisMonth));
BigDecimal clickRate = (null == spaceDTO.getExposureNum() || spaceDTO.getExposureNum().equals(0L)) ? BigDecimal.ZERO :
new BigDecimal(spaceDTO.getClickNum().doubleValue() / spaceDTO.getExposureNum()).setScale(2, BigDecimal.ROUND_HALF_UP);
spaceDTO.setClickRate(clickRate);
BigDecimal income = getIncomeByAdId(spaceDTO.getId(), bookId, channelId, statisMonth);
spaceDTO.setTotalIncome(income);
// 填充广告位置名称
fillAdpositionName4CommonAd(spaceDTO);
}
return pageBean;
}
/**
* 导出书刊广告位明细
*/
@Override
public Map<String, Object> exportAdvertisingDetail4Book(Long bookId, Long channelId, Long adviserId, String statisMonth) throws BizException {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookId", bookId);
paramMap.put("channelId", channelId);
paramMap.put("adviserId", adviserId);
List<AdvertisingSpaceDTO> list = advertisingSpaceDao.advertisingDetail4Book(paramMap);
if (ListUtils.isEmpty(list)) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "暂无数据导出!");
}
// 字段名
String[] rowsName = {"序号", "广告位名称", "广告主", "广告位置", "投放时间", "曝光量", "点击量", "点击率", "累积收益"};
List<Object[]> dataList = new ArrayList<>();
Object[] objs;
for (int i = 0; i < list.size(); i++) {
AdvertisingSpaceDTO spaceDTO = list.get(i);
objs = new Object[rowsName.length];
objs[0] = i + 1;
objs[1] = spaceDTO.getAdName();
AdvertisingMaster master = advertisingMasterDao.getById(spaceDTO.getMasterId());
objs[2] = null != master ? master.getMasterName() : "";
fillAdpositionName4CommonAd(spaceDTO);
objs[3] = spaceDTO.getAdPositionName();
objs[4] = DateNewUtils.formatDate(spaceDTO.getDistributionTime());
Long exposureNum = getExposureNumByAdId(spaceDTO.getId(), bookId, adviserId, channelId, statisMonth);
objs[5] = exposureNum;
Long clickNum = getClickNumByAdId(spaceDTO.getId(), bookId, adviserId, channelId, statisMonth);
objs[6] = clickNum;
BigDecimal clickRate = (null == exposureNum || exposureNum.equals(0L)) ? BigDecimal.ZERO :
new BigDecimal(clickNum.doubleValue() / exposureNum).setScale(2, BigDecimal.ROUND_HALF_UP);
objs[7] = clickRate.multiply(new BigDecimal(100)).setScale(0, BigDecimal.ROUND_HALF_UP) + "%";
BigDecimal income = getIncomeByAdId(spaceDTO.getId(), bookId, channelId, statisMonth);
objs[8] = income + "元";
dataList.add(objs);
}
BookDto bookDto = bookBiz.getBaseById(bookId);
String[] dateStr = statisMonth.split("-");
String fileName = StringUtil.addBracket(bookDto.getBookName()) + dateStr[0] + "年" + Integer.parseInt(dateStr[1]) + "月广告位明细";
String fileUrl = exportConsr.exportExcel(fileName, rowsName, dataList);
Map<String, Object> result = new HashMap<>();
result.put("fileUrl", fileUrl);
result.put("fileName", fileName);
return result;
}
/**
* 填充作品应用、社群码页面广告位名称
*/
private void fillAdpositionName4CommonAd(AdvertisingSpaceDTO spaceDTO) {
String adPositionName = "";
String adPositionModeName = AdPositionModeEnum.getNameByCode(spaceDTO.getAdPositionMode());
if (AdPositionEnum.BOOK_GROUP_PAGE.positionCode.equals(spaceDTO.getAdPosition())) {
adPositionName = AdPositionDetailEnum.getNameByCode(spaceDTO.getAdPositionDetail()) + ">" + adPositionModeName;
} else {
int index = spaceDTO.getAdPositionDetail().indexOf("_");
String type = spaceDTO.getAdPositionDetail().substring(0, index);
String typeCode = spaceDTO.getAdPositionDetail().substring(index + 1, spaceDTO.getAdPositionDetail().length());
if ("APP".equalsIgnoreCase(type)) {
AppTypeDto appTypeDto = ResponseHandleUtil.parseResponse(appTypeService.getByTypeCode(typeCode), AppTypeDto.class);
if (null != appTypeDto) {
adPositionName = appTypeDto.getTypeName() + ">" + adPositionModeName;
} else {
adPositionName = adPositionModeName;
}
} else {
String productTypeName = ResponseHandleUtil.parseResponse(productService.getProTypeName(typeCode), String.class);
if (!StringUtil.isEmpty(productTypeName)) {
adPositionName = productTypeName + ">" + adPositionModeName;
} else {
adPositionName = adPositionModeName;
}
}
}
spaceDTO.setAdPositionName(adPositionName);
}
/**
* 填充作品应用、社群码页面广告位名称
*/
private void fillAdpositionName4WechatGroupAd(AdvertisingSpaceDTO spaceDTO) {
String adPositionName = AdPositionEnum.getNameByCode(spaceDTO.getAdPosition()) + ">" + AdPositionModeEnum.getNameByCode(spaceDTO.getAdPositionMode());
spaceDTO.setAdPositionName(adPositionName);
}
/**
* 微信群广告位明细
*/
@Override
public PageBean advertisingDetail4WechatGroup(Long qrcodeId, String statisMonth, PageParam pageParam) throws BizException {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("qrcodeId", qrcodeId);
PageBean pageBean = advertisingSpaceDao.listPage(pageParam, paramMap, "advertisingDetail4WechatGroup");
if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) {
return new PageBean(0, 0, new ArrayList<>());
}
// 填充投放数据
for (Object object : pageBean.getRecordList()) {
AdvertisingSpaceDTO spaceDTO = (AdvertisingSpaceDTO) object;
if (null == spaceDTO) {
continue;
}
AdvertisingMaster master = advertisingMasterDao.getById(spaceDTO.getMasterId());
if (null != master) {
spaceDTO.setMasterName(master.getMasterName());
}
spaceDTO.setExposureNum(getExposureNumByGroupQrcodeId(qrcodeId, spaceDTO.getId(), statisMonth));
spaceDTO.setClickNum(getClickNumByGroupQrcodeId(qrcodeId, spaceDTO.getId(), statisMonth));
BigDecimal clickRate = (null == spaceDTO.getExposureNum() || spaceDTO.getExposureNum().equals(0L)) ? BigDecimal.ZERO :
new BigDecimal(spaceDTO.getClickNum().doubleValue() / spaceDTO.getExposureNum()).setScale(2, BigDecimal.ROUND_HALF_UP);
spaceDTO.setClickRate(clickRate);
BigDecimal income = getIncomeByGroupQrcodeId(qrcodeId, spaceDTO.getId(), statisMonth);
spaceDTO.setTotalIncome(income);
// 点击读者量
if (!AdPositionModeEnum.JUST_PIC.modeCode.equals(spaceDTO.getAdPositionMode()) && !StringUtil.isEmpty(spaceDTO.getAdLink())) {
spaceDTO.setClickUserNum(getClickUserNumByGroupQrcodeId(qrcodeId, spaceDTO.getId(), statisMonth));
} else {
spaceDTO.setClickUserNum(0L);
}
// 填充广告位置名称
spaceDTO.setAdPositionName(AdPositionModeEnum.getNameByCode(spaceDTO.getAdPositionMode()));
}
return pageBean;
}
/**
* 导出微信群广告位明细
*/
@Override
public Map<String, Object> exportAdvertisingDetail4WechatGroup(Long qrcodeId, String statisMonth) throws BizException {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("qrcodeId", qrcodeId);
List<AdvertisingSpaceDTO> list = advertisingSpaceDao.advertisingDetail4WechatGroup(paramMap);
if (ListUtils.isEmpty(list)) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "暂无数据导出!");
}
// 字段名
String[] rowsName = {"序号", "广告位名称", "广告主", "广告位置", "投放时间", "曝光量", "点击量", "点击率", "累积收益"};
List<Object[]> dataList = new ArrayList<>();
Object[] objs;
for (int i = 0; i < list.size(); i++) {
AdvertisingSpaceDTO spaceDTO = list.get(i);
objs = new Object[rowsName.length];
objs[0] = i + 1;
objs[1] = spaceDTO.getAdName();
AdvertisingMaster master = advertisingMasterDao.getById(spaceDTO.getMasterId());
objs[2] = null != master ? master.getMasterName() : "";
objs[3] = AdPositionModeEnum.getNameByCode(spaceDTO.getAdPositionMode());
objs[4] = DateNewUtils.formatDate(spaceDTO.getDistributionTime());
Long exposureNum = getExposureNumByGroupQrcodeId(qrcodeId, spaceDTO.getId(), statisMonth);
objs[5] = exposureNum;
Long clickNum = getClickNumByGroupQrcodeId(qrcodeId, spaceDTO.getId(), statisMonth);
objs[6] = clickNum;
BigDecimal clickRate = (null == exposureNum || exposureNum.equals(0L)) ? BigDecimal.ZERO :
new BigDecimal(clickNum.doubleValue() / exposureNum).setScale(2, BigDecimal.ROUND_HALF_UP);
objs[7] = clickRate.multiply(new BigDecimal(100)).setScale(0, BigDecimal.ROUND_HALF_UP) + "%";
BigDecimal income = getIncomeByGroupQrcodeId(qrcodeId, spaceDTO.getId(), statisMonth);
objs[8] = income + "元";
dataList.add(objs);
}
GroupQrcode groupQrcode = groupQrcodeDao.getById(qrcodeId);
String[] dateStr = statisMonth.split("-");
String fileName = (null != groupQrcode ? groupQrcode.getGroupName() : "") + dateStr[0] + "年" + Integer.parseInt(dateStr[1]) + "月广告位明细";
String fileUrl = exportConsr.exportExcel(fileName, rowsName, dataList);
Map<String, Object> result = new HashMap<>();
result.put("fileUrl", fileUrl);
result.put("fileName", fileName);
return result;
}
/**
* 微信群广告位点击读者列表
*/
@Override
public PageBean clickUserList4AdvertisingWechatGroup(Long qrcodeId, Long adId, String statisMonth, PageParam pageParam) throws BizException {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("qrcodeId", qrcodeId);
paramMap.put("adId", adId);
paramMap.put("statisMonth", statisMonth);
PageBean pageBean = advertisingClickRecordDao.listPage(pageParam, paramMap, "clickUserList4AdvertisingWechatGroup");
if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) {
return new PageBean(0, 0, new ArrayList<>());
}
List<Long> wechatUserIds = new ArrayList<>();
pageBean.getRecordList().forEach(obj -> {
wechatUserIds.add(((WechatGroupClickUserDTO) obj).getWechatUserId());
});
Map<Long, WechatUser> wechatUserMap = readerConsr.getUserList(wechatUserIds);
for (Object object : pageBean.getRecordList()) {
WechatGroupClickUserDTO dto = (WechatGroupClickUserDTO) object;
if (!MapUtils.isEmpty(wechatUserMap) && wechatUserMap.containsKey(dto.getWechatUserId())) {
WechatUser wechatUser = wechatUserMap.get(dto.getWechatUserId());
dto.setWechatUserName(wechatUser.getWechatUserNickname());
dto.setWechatUserHeadurl(wechatUser.getWechatUserHeadurl());
dto.setWechatUserSex(wechatUser.getWechatUserSex());
dto.setWechatUserProvince(wechatUser.getWechatUserProvince());
dto.setWechatUserCity(wechatUser.getWechatUserCity());
}
}
return pageBean;
}
/**
* 导出微信群广告位点击读者列表
*/
@Override
public Map<String, Object> exportClickUserList4AdvertisingWechatGroup(Long qrcodeId, Long adId, String statisMonth) throws BizException {
AdvertisingSpace space = advertisingSpaceDao.getById(adId);
if (null == space) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "广告位不存在或已删除!");
}
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("qrcodeId", qrcodeId);
paramMap.put("adId", adId);
paramMap.put("statisMonth", statisMonth);
List<WechatGroupClickUserDTO> list = advertisingClickRecordDao.clickUserList4AdvertisingWechatGroup(paramMap);
if (ListUtils.isEmpty(list)) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "暂无数据导出!");
}
List<Long> wechatUserIds = list.stream().map(WechatGroupClickUserDTO::getWechatUserId).collect(Collectors.toList());
Map<Long, WechatUser> wechatUserMap = readerConsr.getUserList(wechatUserIds);
// 字段名
String[] rowsName = {"序号", "读者信息", "读者标签", "点击时间"};
List<Object[]> dataList = new ArrayList<>();
Object[] objs;
for (int i = 0; i < list.size(); i++) {
WechatGroupClickUserDTO dto = list.get(i);
objs = new Object[rowsName.length];
objs[0] = i + 1;
if (!MapUtils.isEmpty(wechatUserMap) && wechatUserMap.containsKey(dto.getWechatUserId())) {
WechatUser wechatUser = wechatUserMap.get(dto.getWechatUserId());
objs[1] = wechatUser.getWechatUserNickname();
String sex = wechatUser.getWechatUserSex().equals(1) ? "男" : (wechatUser.getWechatUserSex().equals(2) ? "女" : "未知");
objs[2] = sex + "," + wechatUser.getWechatUserCity();
} else {
objs[1] = "";
objs[2] = "";
}
objs[3] = DateNewUtils.formatDate(dto.getCreateTime());
dataList.add(objs);
}
GroupQrcode groupQrcode = groupQrcodeDao.getById(qrcodeId);
String[] dateStr = statisMonth.split("-");
String fileName;
if (StringUtil.isEmpty(statisMonth)) {
fileName = (null != groupQrcode ? groupQrcode.getGroupName() : "") + dateStr[0] + "年" + Integer.parseInt(dateStr[1]) + "月" + space.getAdName() + "广告位点击读者明细";
} else {
fileName = space.getAdName() + "广告位" + (null != groupQrcode ? groupQrcode.getGroupName() : "") + "点击读者明细";
}
String fileUrl = exportConsr.exportExcel(fileName, rowsName, dataList);
Map<String, Object> result = new HashMap<>();
result.put("fileUrl", fileUrl);
result.put("fileName", fileName);
return result;
}
/**
* 广告主广告位明细
*/
@Override
public PageBean advertisingDetail4Master(Long masterId, String statisMonth, PageParam pageParam) throws BizException {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("masterId", masterId);
PageBean pageBean = advertisingSpaceDao.listPage(pageParam, paramMap, "advertisingDetail4Master");
if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) {
return new PageBean(0, 0, new ArrayList<>());
}
// 填充投放数据
for (Object object : pageBean.getRecordList()) {
AdvertisingSpaceDTO spaceDTO = (AdvertisingSpaceDTO) object;
if (null == spaceDTO) {
continue;
}
Long exposureNum = 0L;
Long clickNum = 0L;
BigDecimal income = BigDecimal.ZERO;
if (null != spaceDTO.getBookId()) {
if (AdPositionEnum.WECHAT_GROUP_MSG.positionCode.equals(spaceDTO.getAdPosition())) {
exposureNum = getExposureNumByGroupQrcodeId(spaceDTO.getQrcodeId(), spaceDTO.getId(), statisMonth);
clickNum = getClickNumByGroupQrcodeId(spaceDTO.getQrcodeId(), spaceDTO.getId(), statisMonth);
income = getIncomeByGroupQrcodeId(spaceDTO.getQrcodeId(), spaceDTO.getId(), statisMonth);
} else {
exposureNum = getExposureNumByAdId(spaceDTO.getId(), spaceDTO.getBookId(), spaceDTO.getAdviserId(), spaceDTO.getChannelId(), statisMonth);
clickNum = getClickNumByAdId(spaceDTO.getId(), spaceDTO.getBookId(), spaceDTO.getAdviserId(), spaceDTO.getChannelId(), statisMonth);
income = getIncomeByAdId(spaceDTO.getId(), spaceDTO.getBookId(), spaceDTO.getChannelId(), statisMonth);
}
}
BigDecimal clickRate = (null == exposureNum || exposureNum.equals(0L)) ? BigDecimal.ZERO :
new BigDecimal(clickNum.doubleValue() / exposureNum).setScale(2, BigDecimal.ROUND_HALF_UP);
spaceDTO.setExposureNum(exposureNum);
spaceDTO.setClickNum(clickNum);
spaceDTO.setClickRate(clickRate);
spaceDTO.setTotalIncome(income);
// 填充广告位置名称
if (AdPositionEnum.WECHAT_GROUP_MSG.positionCode.equals(spaceDTO.getAdPosition())) {
fillAdpositionName4WechatGroupAd(spaceDTO);
} else {
fillAdpositionName4CommonAd(spaceDTO);
}
// 填充投放渠道信息
if (null != spaceDTO.getBookId()) {
if (AdPositionEnum.WECHAT_GROUP_MSG.positionCode.equals(spaceDTO.getAdPosition())) {
GroupQrcode groupQrcode = groupQrcodeDao.getById(spaceDTO.getQrcodeId());
BookDto bookDto = bookBiz.getBaseById(spaceDTO.getBookId());
spaceDTO.setGroupQrcodeName(null != groupQrcode ? groupQrcode.getGroupName() : "");
spaceDTO.setBookName(StringUtil.addBracket(bookDto.getBookName())); spaceDTO.setBookName(StringUtil.addBracket(bookDto.getBookName()));
spaceDTO.setIsbn(bookDto.getIsbn());
} else { } else {
spaceDTO.setBookNum(0); BookDto bookDto = bookBiz.getBaseById(spaceDTO.getBookId());
spaceDTO.setBookName(StringUtil.addBracket(bookDto.getBookName()));
spaceDTO.setIsbn(bookDto.getIsbn());
Map<Long, String> agentNameMap = agentConsr.getNames(Arrays.asList(spaceDTO.getAgentId()));
if (!MapUtils.isEmpty(agentNameMap) && agentNameMap.containsKey(spaceDTO.getAgentId())) {
spaceDTO.setAgentName(agentNameMap.get(spaceDTO.getAgentId()));
} else {
spaceDTO.setAgentName("");
}
} }
} }
} }
...@@ -533,15 +1360,95 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz { ...@@ -533,15 +1360,95 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
} }
/** /**
* 导出广告主广告位明细
*/
@Override
public Map<String, Object> exportAdvertisingDetail4Master(Long masterId, String statisMonth) throws BizException {
AdvertisingMaster master = advertisingMasterDao.getById(masterId);
if (null == master) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "广告主不存在!");
}
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("masterId", masterId);
List<AdvertisingSpaceDTO> list = advertisingSpaceDao.advertisingDetail4Master(paramMap);
if (ListUtils.isEmpty(list)) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "暂无数据导出!");
}
// 字段名
String[] rowsName = {"序号", "广告位名称", "对方ID", "广告位置", "投放渠道", "投放时间", "曝光量", "点击量", "点击率", "累积收益"};
List<Object[]> dataList = new ArrayList<>();
Object[] objs;
for (int i = 0; i < list.size(); i++) {
AdvertisingSpaceDTO spaceDTO = list.get(i);
objs = new Object[rowsName.length];
objs[0] = i + 1;
objs[1] = spaceDTO.getAdName();
objs[2] = spaceDTO.getSourceId();
// 填充广告位置名称
String distributionChannel = "";
if (AdPositionEnum.WECHAT_GROUP_MSG.positionCode.equals(spaceDTO.getAdPosition())) {
fillAdpositionName4WechatGroupAd(spaceDTO);
if (null != spaceDTO.getBookId()) {
GroupQrcode groupQrcode = groupQrcodeDao.getById(spaceDTO.getQrcodeId());
BookDto bookDto = bookBiz.getBaseById(spaceDTO.getBookId());
distributionChannel = (null != groupQrcode ? groupQrcode.getGroupName() : "") + "\r\n社群书" + StringUtil.addBracket(bookDto.getBookName()) + "\r\n书号:" + bookDto.getIsbn();
}
} else {
fillAdpositionName4CommonAd(spaceDTO);
if (null != spaceDTO.getBookId()) {
BookDto bookDto = bookBiz.getBaseById(spaceDTO.getBookId());
Map<Long, String> agentNameMap = agentConsr.getNames(Arrays.asList(spaceDTO.getAgentId()));
String agentName = "";
if (!MapUtils.isEmpty(agentNameMap) && agentNameMap.containsKey(spaceDTO.getAgentId())) {
agentName = agentNameMap.get(spaceDTO.getAgentId());
}
distributionChannel = StringUtil.addBracket(bookDto.getBookName()) + "\r\n出版社:" + agentName + "\r\n书号:" + bookDto.getIsbn();
}
}
objs[3] = spaceDTO.getAdPositionName();
objs[4] = distributionChannel;
objs[5] = DateNewUtils.formatDate(spaceDTO.getDistributionTime());
Long exposureNum = 0L;
Long clickNum = 0L;
BigDecimal income = BigDecimal.ZERO;
if (null != spaceDTO.getBookId()) {
if (AdPositionEnum.WECHAT_GROUP_MSG.positionCode.equals(spaceDTO.getAdPosition())) {
exposureNum = getExposureNumByGroupQrcodeId(spaceDTO.getQrcodeId(), spaceDTO.getId(), statisMonth);
clickNum = getClickNumByGroupQrcodeId(spaceDTO.getQrcodeId(), spaceDTO.getId(), statisMonth);
income = getIncomeByGroupQrcodeId(spaceDTO.getQrcodeId(), spaceDTO.getId(), statisMonth);
} else {
exposureNum = getExposureNumByAdId(spaceDTO.getId(), spaceDTO.getBookId(), spaceDTO.getAdviserId(), spaceDTO.getChannelId(), statisMonth);
clickNum = getClickNumByAdId(spaceDTO.getId(), spaceDTO.getBookId(), spaceDTO.getAdviserId(), spaceDTO.getChannelId(), statisMonth);
income = getIncomeByAdId(spaceDTO.getId(), spaceDTO.getBookId(), spaceDTO.getChannelId(), statisMonth);
}
}
objs[6] = exposureNum;
objs[7] = clickNum;
BigDecimal clickRate = (null == exposureNum || exposureNum.equals(0L)) ? BigDecimal.ZERO :
new BigDecimal(clickNum.doubleValue() / exposureNum).setScale(2, BigDecimal.ROUND_HALF_UP);
objs[8] = clickRate.multiply(new BigDecimal(100)).setScale(0, BigDecimal.ROUND_HALF_UP) + "%";
objs[9] = income + "元";
dataList.add(objs);
}
String[] dateStr = statisMonth.split("-");
String fileName = master.getMasterName() + dateStr[0] + "年" + Integer.parseInt(dateStr[1]) + "月广告位明细";
String fileUrl = exportConsr.exportExcel(fileName, rowsName, dataList);
Map<String, Object> result = new HashMap<>();
result.put("fileUrl", fileUrl);
result.put("fileName", fileName);
return result;
}
/**
* 客户端获取书刊配置的广告位信息 * 客户端获取书刊配置的广告位信息
*/ */
@Override @Override
@ParamLog("客户端获取书刊配置的广告位信息") @ParamLog("客户端获取书刊配置的广告位信息")
public AdvertisingSpaceDTO get4Wechat(Long sceneId, Long adviserId, Long channelId) throws BizException { public List<AdvertisingSpaceDTO> get4Wechat(Long sceneId, Long adviserId, Long channelId, String adPositionDetail) throws BizException {
Long agentId = adviserConsr.getAgentIdByAdviser(adviserId); Long agentId = adviserConsr.getAgentIdByAdviser(adviserId);
Long bookId = ResponseHandleUtil.parseResponse(qrcodeSceneService.getBookId4SceneId(sceneId), Long.class); Long bookId = ResponseHandleUtil.parseResponse(qrcodeSceneService.getBookId4SceneId(sceneId), Long.class);
if (null == agentId || null == bookId) { if (null == agentId || null == bookId) {
return new AdvertisingSpaceDTO(); return new ArrayList<>();
} }
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookId", bookId); paramMap.put("bookId", bookId);
...@@ -550,15 +1457,45 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz { ...@@ -550,15 +1457,45 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
paramMap.put("agentId", agentId); paramMap.put("agentId", agentId);
Boolean bookIsOpen = (Boolean) advertisingAdviserPermissionDao.getBy(paramMap, "checkBookOpen"); Boolean bookIsOpen = (Boolean) advertisingAdviserPermissionDao.getBy(paramMap, "checkBookOpen");
if (null == bookIsOpen || !bookIsOpen) { if (null == bookIsOpen || !bookIsOpen) {
return new ArrayList<>();
}
paramMap.put("adPositionDetail", adPositionDetail);
List<AdvertisingSpaceDTO> list = advertisingSpaceDao.getDTOByBookId(paramMap);
if (ListUtils.isEmpty(list)) {
return new ArrayList<>();
}
if (!ListUtils.isEmpty(list)) {
list.forEach(spaceDTO -> spaceDTO.setBookId(bookId));
}
return list;
}
/**
* 获取社群书配置的广告位信息
*/
@Override
@ParamLog("获取社群书配置的广告位信息")
public AdvertisingSpaceDTO getBookGroupAd4Wechat(Long bookGroupId, String adPositionDetail) throws BizException {
BookGroupDTO bookGroupDTO = bookGroupDao.getDTOById(bookGroupId);
if (null == bookGroupDTO) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "该社群书不存在或已删除!");
}
Long agentId = adviserConsr.getAgentIdByAdviser(bookGroupDTO.getCreateUser());
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookId", bookGroupDTO.getBookId());
paramMap.put("adviserId", bookGroupDTO.getCreateUser());
paramMap.put("channelId", bookGroupDTO.getChannelId());
paramMap.put("agentId", agentId);
Boolean bookIsOpen = (Boolean) advertisingAdviserPermissionDao.getBy(paramMap, "checkBookOpen");
if (null == bookIsOpen || !bookIsOpen) {
return new AdvertisingSpaceDTO(); return new AdvertisingSpaceDTO();
} }
AdvertisingSpaceDTO spaceDTO = (AdvertisingSpaceDTO) advertisingSpaceDao.getBy(paramMap, "getDTOByBookId"); paramMap.put("adPositionDetail", adPositionDetail);
AdvertisingSpaceDTO spaceDTO = (AdvertisingSpaceDTO) advertisingSpaceDao.getBy(paramMap, "getDTOByBookId4BookGroup");
if (null == spaceDTO) { if (null == spaceDTO) {
spaceDTO = (AdvertisingSpaceDTO) advertisingSpaceDao.getBy(paramMap, "getNoSignBookAd"); return new AdvertisingSpaceDTO();
}
if (null != spaceDTO) {
spaceDTO.setBookId(bookId);
} }
spaceDTO.setBookId(bookGroupDTO.getBookId());
return spaceDTO; return spaceDTO;
} }
...@@ -572,8 +1509,18 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz { ...@@ -572,8 +1509,18 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
|| advertisingExposureRecord.getFromId() <= 0L) { || advertisingExposureRecord.getFromId() <= 0L) {
return; return;
} }
AdvertisingSpace space = advertisingSpaceDao.getById(advertisingExposureRecord.getAdId());
if (null == space) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "广告位不存在或已删除!");
}
Long agentId = channelConsr.getParentId(advertisingExposureRecord.getChannelId()); Long agentId = channelConsr.getParentId(advertisingExposureRecord.getChannelId());
advertisingExposureRecord.setAgentId(agentId); advertisingExposureRecord.setAgentId(agentId);
if (AdPositionEnum.BOOK_GROUP_PAGE.positionCode.equals(space.getAdPosition())) {
advertisingExposureRecord.setIsBookGroup(true);
} else {
advertisingExposureRecord.setIsBookGroup(false);
}
advertisingExposureRecord.setCount(1L);
advertisingExposureRecordDao.insert(advertisingExposureRecord); advertisingExposureRecordDao.insert(advertisingExposureRecord);
} }
...@@ -587,8 +1534,252 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz { ...@@ -587,8 +1534,252 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
|| advertisingClickRecord.getFromId() <= 0L) { || advertisingClickRecord.getFromId() <= 0L) {
return; return;
} }
if ("WECHAT_GROUP".equals(advertisingClickRecord.getFromType())) {
BookGroup bookGroup = bookGroupDao.getById(advertisingClickRecord.getBookGroupId());
if (null == bookGroup) {
return;
}
advertisingClickRecord.setBookId(bookGroup.getBookId());
advertisingClickRecord.setChannelId(bookGroup.getChannelId());
advertisingClickRecord.setAdviserId(bookGroup.getCreateUser());
}
AdvertisingSpace space = advertisingSpaceDao.getById(advertisingClickRecord.getAdId());
if (null == space) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "广告位不存在或已删除!");
}
Long agentId = channelConsr.getParentId(advertisingClickRecord.getChannelId()); Long agentId = channelConsr.getParentId(advertisingClickRecord.getChannelId());
advertisingClickRecord.setAgentId(agentId); advertisingClickRecord.setAgentId(agentId);
if (!AdPositionEnum.APP_OR_PRODUCT.positionCode.equals(space.getAdPosition())) {
advertisingClickRecord.setIsBookGroup(true);
} else {
advertisingClickRecord.setIsBookGroup(false);
}
advertisingClickRecordDao.insert(advertisingClickRecord); advertisingClickRecordDao.insert(advertisingClickRecord);
} }
/**
* 添加广告主
*/
@Override
@ParamLog(value = "添加广告主", isAfterReturn = false)
@Transactional(rollbackFor = Exception.class)
public void createMaster(AdvertisingMaster advertisingMaster) throws BizException {
if (StringUtil.isEmpty(advertisingMaster.getMasterName()) || ListUtils.isEmpty(advertisingMaster.getSettlementMethodList())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!");
}
boolean paramError = advertisingMaster.getSettlementMethodList().stream().anyMatch(method ->
StringUtil.isEmpty(method.getSettlementMethod()) || !ArrayUtils.contains(SettlementMethodEnum.SETTLEMENT_METHOD_GATHER, method.getSettlementMethod()));
if (paramError) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!");
}
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("masterName", advertisingMaster.getMasterName());
Boolean nameExist = (Boolean) advertisingMasterDao.getBy(paramMap, "checkMasterNameExist");
if (null != nameExist && nameExist) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "广告主已存在!");
}
advertisingMasterDao.insert(advertisingMaster);
Long masterId = advertisingMaster.getId();
advertisingMaster.getSettlementMethodList().forEach(method -> method.setMasterId(masterId));
advertisingSettlementMethodDao.insert(advertisingMaster.getSettlementMethodList());
}
/**
* 修改广告主
*/
@Override
@ParamLog(value = "修改广告主", isAfterReturn = false)
@Transactional(rollbackFor = Exception.class)
public void updateMaster(AdvertisingMaster advertisingMaster) throws BizException {
if (null == advertisingMaster.getId() || StringUtil.isEmpty(advertisingMaster.getMasterName()) || ListUtils.isEmpty(advertisingMaster.getSettlementMethodList())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!");
}
boolean paramError = advertisingMaster.getSettlementMethodList().stream().anyMatch(method ->
StringUtil.isEmpty(method.getSettlementMethod()) || !ArrayUtils.contains(SettlementMethodEnum.SETTLEMENT_METHOD_GATHER, method.getSettlementMethod()));
if (paramError) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!");
}
Long masterId = advertisingMaster.getId();
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("masterName", advertisingMaster.getMasterName());
paramMap.put("masterId", masterId);
Boolean nameExist = (Boolean) advertisingMasterDao.getBy(paramMap, "checkMasterNameExist");
if (null != nameExist && nameExist) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "广告主名称不能重复!");
}
advertisingMasterDao.update(advertisingMaster);
// 删除广告主之前配置的结算方式
advertisingSettlementMethodDao.deleteByMasterId(masterId);
advertisingMaster.getSettlementMethodList().forEach(method -> method.setMasterId(masterId));
advertisingSettlementMethodDao.insert(advertisingMaster.getSettlementMethodList());
}
/**
* 获取广告主列表
*/
@Override
public PageBean getMasterList(PageParam pageParam, String masterName) throws BizException {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("masterName", masterName);
PageBean pageBean = advertisingMasterDao.listPage(pageParam, paramMap, "getMasterList");
if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) {
return new PageBean(0, 0, new ArrayList<>());
}
for (Object object : pageBean.getRecordList()) {
AdvertisingMasterDTO masterDTO = (AdvertisingMasterDTO) object;
List<AdvertisingSettlementMethodDTO> methodDTOList = advertisingSettlementMethodDao.getByMasterId(masterDTO.getId());
if (!ListUtils.isEmpty(methodDTOList)) {
methodDTOList.forEach(dto -> dto.setSettlementMethodName(SettlementMethodEnum.getNameByCode(dto.getSettlementMethod())));
}
masterDTO.setSettlementMethodList(methodDTOList);
Long exposureNum = getExposureNumByMasterId(masterDTO.getId());
masterDTO.setExposureNum(exposureNum);
Long clickNum = getClickNumByMasterId(masterDTO.getId());
masterDTO.setClickNum(clickNum);
BigDecimal clickRate = (null == masterDTO.getExposureNum() || masterDTO.getExposureNum().equals(0L)) ? BigDecimal.ZERO :
new BigDecimal(masterDTO.getClickNum().doubleValue() / masterDTO.getExposureNum()).setScale(2, BigDecimal.ROUND_HALF_UP);
masterDTO.setClickRate(clickRate);
BigDecimal income = getIncomeByMasterId(masterDTO.getId());
masterDTO.setTotalIncome(income);
}
return pageBean;
}
/**
* 获取所有广告主
*/
@Override
public List<AdvertisingMasterDTO> getAllMaster() throws BizException {
List<AdvertisingMasterDTO> list = advertisingMasterDao.getAllMaster();
if (!ListUtils.isEmpty(list)) {
for (AdvertisingMasterDTO masterDTO : list) {
List<AdvertisingSettlementMethodDTO> methodDTOList = advertisingSettlementMethodDao.getByMasterId(masterDTO.getId());
if (!ListUtils.isEmpty(methodDTOList)) {
methodDTOList.forEach(dto -> dto.setSettlementMethodName(SettlementMethodEnum.getNameByCode(dto.getSettlementMethod())));
}
masterDTO.setSettlementMethodList(methodDTOList);
}
}
return list;
}
/**
* 获取广告主信息
*/
@Override
public AdvertisingMasterDTO getMasterInfo(Long masterId) throws BizException {
return advertisingMasterDao.getDTOById(masterId);
}
/**
* 每日凌晨计算昨日广告位收益
*/
@Override
@ParamLog(value = "每日凌晨计算昨日广告位收益", isAfterReturn = false)
public void calculateAdvertisingIncomeYesterday() throws BizException {
new Thread() {
@Override
public void run() {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("createDay", DateNewUtils.getShortDateStr(DateNewUtils.addDay(new Date(), -1)));
// 插入扫社群码页面和作品/应用广告位的昨日收益数据
advertisingIncomeDailyDao.insertRecordWithoutWechatGroupMsgAd(paramMap);
// 插入微信群消息广告位的昨日收益数据
advertisingIncomeDailyDao.insertWechatGroupMsgAdRecord(paramMap);
}
}.start();
}
/**
* 获取概览数据
*/
@Override
@ParamLog("获取概览数据")
public Map<String, Object> overviewStatis() throws BizException {
Map<String, Object> result = new HashMap<>();
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("statis", "all");
Long advertisingSpaceNum = (Long) advertisingSpaceDao.getBy(paramMap, "getSpaceNum");
result.put("advertisingSpaceNum", advertisingSpaceNum);
Long distributionBookNum = (Long) advertisingDistributionBookDao.getBy(paramMap, "getDistributionBookNum");
result.put("distributionBookNum", distributionBookNum);
Long distributionWechatGroupNum = (Long) advertisingDistributionBookDao.getBy(paramMap, "getDistributionWechatGroupNum");
result.put("distributionWechatGroupNum", distributionWechatGroupNum);
Long exposureNum = (Long) advertisingExposureRecordDao.getBy(paramMap, "getTotalExposureNum");
result.put("exposureNum", exposureNum);
Long clickNum = (Long) advertisingClickRecordDao.getBy(paramMap, "getTotalClickNum");
result.put("clickNum", clickNum);
BigDecimal clickRate = (null == exposureNum || exposureNum.equals(0L)) ? BigDecimal.ZERO :
new BigDecimal(clickNum.doubleValue() / exposureNum).setScale(2, BigDecimal.ROUND_HALF_UP);
result.put("clickRate", clickRate);
BigDecimal totalIncome = (BigDecimal) advertisingIncomeDailyDao.getBy(paramMap, "getTotalIncome");
result.put("totalIncome", null == totalIncome ? BigDecimal.ZERO : totalIncome.setScale(2, BigDecimal.ROUND_HALF_UP));
return result;
}
/**
* 获取流量趋势
*/
@Override
public List<Object> getFlowStatisTrend(Integer day, String startDate, String endDate) throws BizException {
if (null == day && (StringUtil.isEmpty(startDate) || StringUtil.isEmpty(endDate))) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!");
}
Map<String, Object> paramMap = new HashMap<>();
if (!StringUtil.isEmpty(startDate) && !StringUtil.isEmpty(endDate)) {
paramMap.put("collectDates", CommonUtils.collectLocalDates(startDate, endDate));
paramMap.put("startDate", startDate);
paramMap.put("endDate", endDate);
} else {
Date startTime = DateUtils.addDay(new Date(), -day);
Date endTime = DateUtils.addDay(new Date(), -1);
paramMap.put("collectDates", CommonUtils.collectLocalDates(startTime, endTime));
paramMap.put("startDate", DateNewUtils.getShortDateStr(startTime));
paramMap.put("endDate", DateNewUtils.getShortDateStr(endTime));
}
return advertisingExposureRecordDao.listBy(paramMap, "getFlowStatisTrend");
}
/**
* 获取收益趋势
*/
@Override
public List<Object> getIncomeStatisTrend(Integer day, String startDate, String endDate) throws BizException {
if (null == day && (StringUtil.isEmpty(startDate) || StringUtil.isEmpty(endDate))) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!");
}
Map<String, Object> paramMap = new HashMap<>();
if (!StringUtil.isEmpty(startDate) && !StringUtil.isEmpty(endDate)) {
paramMap.put("collectDates", CommonUtils.collectLocalDates(startDate, endDate));
} else {
Date startTime = DateUtils.addDay(new Date(), -day);
Date endTime = DateUtils.addDay(new Date(), -1);
paramMap.put("collectDates", CommonUtils.collectLocalDates(startTime, endTime));
}
return advertisingIncomeDailyDao.listBy(paramMap, "getIncomeStatisTrend");
}
/**
* 获取微信群信息
*/
@Override
public AdGroupQrcodeDTO getGroupQrcodeInfo(Long qrcodeId) throws BizException {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("qrcodeId", qrcodeId);
AdGroupQrcodeDTO dto = (AdGroupQrcodeDTO) groupQrcodeDao.getBy(paramMap, "getGroupQrcodeInfo4Ad");
if (null == dto) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "微信群不存在或已删除!");
}
Long adviserId = dto.getAdviserId();
String adviserName = adviserConsr.getNameById(adviserId);
dto.setAdviserName(adviserName);
Long agentId = adviserConsr.getAgentIdByAdviser(adviserId);
if (null != agentId) {
Map<Long, String> agentNameMap = agentConsr.getNames(Arrays.asList(agentId));
if (!MapUtils.isEmpty(agentNameMap) && agentNameMap.containsKey(agentId)) {
dto.setAgentName(agentNameMap.get(agentId));
}
}
return dto;
}
} }
package com.pcloud.book.advertising.dao; package com.pcloud.book.advertising.dao;
import java.util.List;
import java.util.Map;
import com.pcloud.book.advertising.dto.WechatGroupClickUserDTO;
import com.pcloud.book.advertising.entity.AdvertisingClickRecord; import com.pcloud.book.advertising.entity.AdvertisingClickRecord;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
...@@ -9,4 +12,11 @@ import com.pcloud.common.core.dao.BaseDao; ...@@ -9,4 +12,11 @@ import com.pcloud.common.core.dao.BaseDao;
* @date 2019/2/28 * @date 2019/2/28
*/ */
public interface AdvertisingClickRecordDao extends BaseDao<AdvertisingClickRecord> { public interface AdvertisingClickRecordDao extends BaseDao<AdvertisingClickRecord> {
/**
* 微信群广告位点击读者列表
* @param paramMap 参数Map
* @return
*/
List<WechatGroupClickUserDTO> clickUserList4AdvertisingWechatGroup(Map<String, Object> paramMap);
} }
package com.pcloud.book.advertising.dao; package com.pcloud.book.advertising.dao;
import java.util.List; import java.util.List;
import java.util.Map;
import com.pcloud.book.advertising.entity.AdvertisingDistributionBook; import com.pcloud.book.advertising.entity.AdvertisingDistributionBook;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
...@@ -19,11 +20,11 @@ public interface AdvertisingDistributionBookDao extends BaseDao<AdvertisingDistr ...@@ -19,11 +20,11 @@ public interface AdvertisingDistributionBookDao extends BaseDao<AdvertisingDistr
long batchInsert(List<AdvertisingDistributionBook> list); long batchInsert(List<AdvertisingDistributionBook> list);
/** /**
* 校验书刊是否已投放 * 校验广告位是否已投放微信群
* @param list 列表 * @param paramMap 参数Map
* @return * @return
*/ */
List<Long> checkBookIdExist(List<Long> list); List<Long> checkQrcodeIdExist(Map<String, Object> paramMap);
/** /**
* 获取广告位投放的书刊列表 * 获取广告位投放的书刊列表
......
package com.pcloud.book.advertising.dao; package com.pcloud.book.advertising.dao;
import java.util.List;
import com.pcloud.book.advertising.entity.AdvertisingExposureRecord; import com.pcloud.book.advertising.entity.AdvertisingExposureRecord;
import com.pcloud.book.group.dto.AdGroupQrcodeDTO;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
/** /**
...@@ -9,4 +11,10 @@ import com.pcloud.common.core.dao.BaseDao; ...@@ -9,4 +11,10 @@ import com.pcloud.common.core.dao.BaseDao;
* @date 2019/2/28 * @date 2019/2/28
*/ */
public interface AdvertisingExposureRecordDao extends BaseDao<AdvertisingExposureRecord> { public interface AdvertisingExposureRecordDao extends BaseDao<AdvertisingExposureRecord> {
/**
* 获取广告位投放微信群曝光量前几位
* @return
*/
List<AdGroupQrcodeDTO> advertisingWechatGroupRankTop();
} }
package com.pcloud.book.advertising.dao;
import java.util.Map;
import com.pcloud.book.advertising.entity.AdvertisingIncomeDaily;
import com.pcloud.common.core.dao.BaseDao;
/**
* Description 广告位每日收益统计数据访问层接口
* Created by PENG on 2019/5/6.
*/
public interface AdvertisingIncomeDailyDao extends BaseDao<AdvertisingIncomeDaily> {
/**
* 插入扫社群码页面和作品/应用广告位的昨日收益数据
* @param paramMap 参数Map
* @return
*/
long insertRecordWithoutWechatGroupMsgAd(Map<String, Object> paramMap);
/**
* 插入微信群消息广告位的昨日收益数据
* @param paramMap 参数Map
* @return
*/
long insertWechatGroupMsgAdRecord(Map<String, Object> paramMap);
}
package com.pcloud.book.advertising.dao;
import java.util.List;
import com.pcloud.book.advertising.dto.AdvertisingMasterDTO;
import com.pcloud.book.advertising.entity.AdvertisingMaster;
import com.pcloud.common.core.dao.BaseDao;
/**
* Description 广告主数据访问层接口
* Created by PENG on 2019/4/26.
*/
public interface AdvertisingMasterDao extends BaseDao<AdvertisingMaster> {
/**
* 获取所有广告主
* @return
*/
List<AdvertisingMasterDTO> getAllMaster();
/**
* 获取广告主DTO
* @param masterId 广告主ID
* @return
*/
AdvertisingMasterDTO getDTOById(Long masterId);
}
package com.pcloud.book.advertising.dao;
import java.util.List;
import com.pcloud.book.advertising.dto.AdvertisingSettlementMethodDTO;
import com.pcloud.book.advertising.entity.AdvertisingSettlementMethod;
import com.pcloud.common.core.dao.BaseDao;
/**
* Description 广告结算方式数据访问层接口
* Created by PENG on 2019/4/26.
*/
public interface AdvertisingSettlementMethodDao extends BaseDao<AdvertisingSettlementMethod> {
/**
* 删除广告主配置的结算方式
* @param masterId 广告主ID
* @return
*/
long deleteByMasterId(Long masterId);
/**
* 获取广告主配置的结算方式列表
* @param masterId 广告主ID
* @return
*/
List<AdvertisingSettlementMethodDTO> getByMasterId(Long masterId);
/**
* 获取广告位的结算方式
* @param masterId 广告主ID
* @param adId 广告位ID
* @return
*/
AdvertisingSettlementMethodDTO getByMasterIdAndAdId(Long masterId, Long adId);
}
package com.pcloud.book.advertising.dao; package com.pcloud.book.advertising.dao;
import java.util.List;
import java.util.Map;
import com.pcloud.book.advertising.dto.AdvertisingSpaceDTO; import com.pcloud.book.advertising.dto.AdvertisingSpaceDTO;
import com.pcloud.book.advertising.entity.AdvertisingSpace; import com.pcloud.book.advertising.entity.AdvertisingSpace;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
...@@ -17,4 +19,32 @@ public interface AdvertisingSpaceDao extends BaseDao<AdvertisingSpace> { ...@@ -17,4 +19,32 @@ public interface AdvertisingSpaceDao extends BaseDao<AdvertisingSpace> {
* @return * @return
*/ */
AdvertisingSpaceDTO getDTOById(Long adId); AdvertisingSpaceDTO getDTOById(Long adId);
/**
* 书刊广告位明细
* @param paramMap 参数Map
* @return
*/
List<AdvertisingSpaceDTO> advertisingDetail4Book(Map<String, Object> paramMap);
/**
* 微信群广告位明细
* @param paramMap 参数Map
* @return
*/
List<AdvertisingSpaceDTO> advertisingDetail4WechatGroup(Map<String, Object> paramMap);
/**
* 广告主广告位明细
* @param paramMap 参数Map
* @return
*/
List<AdvertisingSpaceDTO> advertisingDetail4Master(Map<String, Object> paramMap);
/**
* 获取书刊下的广告位列表
* @param paramMap 参数Map
* @return
*/
List<AdvertisingSpaceDTO> getDTOByBookId(Map<String, Object> paramMap);
} }
package com.pcloud.book.advertising.dao.impl; package com.pcloud.book.advertising.dao.impl;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import com.pcloud.book.advertising.dao.AdvertisingClickRecordDao; import com.pcloud.book.advertising.dao.AdvertisingClickRecordDao;
import com.pcloud.book.advertising.dto.WechatGroupClickUserDTO;
import com.pcloud.book.advertising.entity.AdvertisingClickRecord; import com.pcloud.book.advertising.entity.AdvertisingClickRecord;
import com.pcloud.common.core.dao.BaseDaoImpl; import com.pcloud.common.core.dao.BaseDaoImpl;
...@@ -12,4 +15,12 @@ import com.pcloud.common.core.dao.BaseDaoImpl; ...@@ -12,4 +15,12 @@ import com.pcloud.common.core.dao.BaseDaoImpl;
*/ */
@Repository("advertisingClickRecordDao") @Repository("advertisingClickRecordDao")
public class AdvertisingClickRecordDaoImpl extends BaseDaoImpl<AdvertisingClickRecord> implements AdvertisingClickRecordDao { public class AdvertisingClickRecordDaoImpl extends BaseDaoImpl<AdvertisingClickRecord> implements AdvertisingClickRecordDao {
/**
* 微信群广告位点击读者列表
*/
@Override
public List<WechatGroupClickUserDTO> clickUserList4AdvertisingWechatGroup(Map<String, Object> paramMap) {
return super.getSqlSession().selectList(getStatement("clickUserList4AdvertisingWechatGroup"), paramMap);
}
} }
package com.pcloud.book.advertising.dao.impl; package com.pcloud.book.advertising.dao.impl;
import java.util.List; import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import com.pcloud.book.advertising.dao.AdvertisingDistributionBookDao; import com.pcloud.book.advertising.dao.AdvertisingDistributionBookDao;
import com.pcloud.book.advertising.entity.AdvertisingDistributionBook; import com.pcloud.book.advertising.entity.AdvertisingDistributionBook;
...@@ -23,11 +24,11 @@ public class AdvertisingDistributionBookDaoImpl extends BaseDaoImpl<AdvertisingD ...@@ -23,11 +24,11 @@ public class AdvertisingDistributionBookDaoImpl extends BaseDaoImpl<AdvertisingD
} }
/** /**
* 校验书刊是否已投放 * 校验广告位是否已投放微信群
*/ */
@Override @Override
public List<Long> checkBookIdExist(List<Long> list) { public List<Long> checkQrcodeIdExist(Map<String, Object> paramMap) {
return super.getSqlSession().selectList(getStatement("checkBookIdExist"), list); return super.getSqlSession().selectList(getStatement("checkQrcodeIdExist"), paramMap);
} }
/** /**
......
package com.pcloud.book.advertising.dao.impl; package com.pcloud.book.advertising.dao.impl;
import java.util.List;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import com.pcloud.book.advertising.dao.AdvertisingExposureRecordDao; import com.pcloud.book.advertising.dao.AdvertisingExposureRecordDao;
import com.pcloud.book.advertising.entity.AdvertisingExposureRecord; import com.pcloud.book.advertising.entity.AdvertisingExposureRecord;
import com.pcloud.book.group.dto.AdGroupQrcodeDTO;
import com.pcloud.common.core.dao.BaseDaoImpl; import com.pcloud.common.core.dao.BaseDaoImpl;
/** /**
...@@ -12,4 +14,12 @@ import com.pcloud.common.core.dao.BaseDaoImpl; ...@@ -12,4 +14,12 @@ import com.pcloud.common.core.dao.BaseDaoImpl;
*/ */
@Repository("advertisingExposureRecordDao") @Repository("advertisingExposureRecordDao")
public class AdvertisingExposureRecordDaoImpl extends BaseDaoImpl<AdvertisingExposureRecord> implements AdvertisingExposureRecordDao { public class AdvertisingExposureRecordDaoImpl extends BaseDaoImpl<AdvertisingExposureRecord> implements AdvertisingExposureRecordDao {
/**
* 获取广告位投放微信群曝光量前几位
*/
@Override
public List<AdGroupQrcodeDTO> advertisingWechatGroupRankTop() {
return super.getSqlSession().selectList(getStatement("advertisingWechatGroupRankTop"));
}
} }
package com.pcloud.book.advertising.dao.impl;
import java.util.Map;
import org.springframework.stereotype.Repository;
import com.pcloud.book.advertising.dao.AdvertisingIncomeDailyDao;
import com.pcloud.book.advertising.entity.AdvertisingIncomeDaily;
import com.pcloud.common.core.dao.BaseDaoImpl;
/**
* Description 广告位每日收益统计数据访问层接口实现类
* Created by PENG on 2019/5/6.
*/
@Repository("advertisingIncomeDailyDao")
public class AdvertisingIncomeDailyDaoImpl extends BaseDaoImpl<AdvertisingIncomeDaily> implements AdvertisingIncomeDailyDao {
/**
* 插入扫社群码页面和作品/应用广告位的昨日收益数据
*/
@Override
public long insertRecordWithoutWechatGroupMsgAd(Map<String, Object> paramMap) {
return super.getSqlSession().insert(getStatement("insertRecordWithoutWechatGroupMsgAd"), paramMap);
}
/**
* 插入微信群消息广告位的昨日收益数据
*/
@Override
public long insertWechatGroupMsgAdRecord(Map<String, Object> paramMap) {
return super.getSqlSession().insert(getStatement("insertWechatGroupMsgAdRecord"), paramMap);
}
}
package com.pcloud.book.advertising.dao.impl;
import java.util.List;
import org.springframework.stereotype.Repository;
import com.pcloud.book.advertising.dao.AdvertisingMasterDao;
import com.pcloud.book.advertising.dto.AdvertisingMasterDTO;
import com.pcloud.book.advertising.entity.AdvertisingMaster;
import com.pcloud.common.core.dao.BaseDaoImpl;
/**
* Description 广告主数据访问层接口实现类
* Created by PENG on 2019/4/26.
*/
@Repository("advertisingMasterDao")
public class AdvertisingMasterDaoImpl extends BaseDaoImpl<AdvertisingMaster> implements AdvertisingMasterDao {
/**
* 获取所有广告主
*/
@Override
public List<AdvertisingMasterDTO> getAllMaster() {
return super.getSqlSession().selectList(getStatement("getAllMaster"));
}
/**
* 获取广告主DTO
*/
@Override
public AdvertisingMasterDTO getDTOById(Long masterId) {
return super.getSqlSession().selectOne(getStatement("getDTOById"), masterId);
}
}
package com.pcloud.book.advertising.dao.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Repository;
import com.pcloud.book.advertising.dao.AdvertisingSettlementMethodDao;
import com.pcloud.book.advertising.dto.AdvertisingSettlementMethodDTO;
import com.pcloud.book.advertising.entity.AdvertisingSettlementMethod;
import com.pcloud.common.core.dao.BaseDaoImpl;
/**
* Description 广告结算方式数据访问层接口实现类
* Created by PENG on 2019/4/26.
*/
@Repository("advertisingSettlementMethodDao")
public class AdvertisingSettlementMethodDaoImpl extends BaseDaoImpl<AdvertisingSettlementMethod> implements AdvertisingSettlementMethodDao {
/**
* 删除广告主配置的结算方式
*/
@Override
public long deleteByMasterId(Long masterId) {
return super.getSqlSession().delete(getStatement("deleteByMasterId"), masterId);
}
/**
* 获取广告主配置的结算方式列表
*/
@Override
public List<AdvertisingSettlementMethodDTO> getByMasterId(Long masterId) {
return super.getSqlSession().selectList(getStatement("getByMasterId"), masterId);
}
/**
* 获取广告位的结算方式
*/
@Override
public AdvertisingSettlementMethodDTO getByMasterIdAndAdId(Long masterId, Long adId) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("masterId", masterId);
paramMap.put("adId", adId);
return super.getSqlSession().selectOne(getStatement("getByMasterIdAndAdId"), paramMap);
}
}
package com.pcloud.book.advertising.dao.impl; package com.pcloud.book.advertising.dao.impl;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import com.pcloud.book.advertising.dao.AdvertisingSpaceDao; import com.pcloud.book.advertising.dao.AdvertisingSpaceDao;
import com.pcloud.book.advertising.dto.AdvertisingSpaceDTO; import com.pcloud.book.advertising.dto.AdvertisingSpaceDTO;
...@@ -14,8 +16,43 @@ import com.pcloud.common.core.dao.BaseDaoImpl; ...@@ -14,8 +16,43 @@ import com.pcloud.common.core.dao.BaseDaoImpl;
@Repository("advertisingSpaceDao") @Repository("advertisingSpaceDao")
public class AdvertisingSpaceDaoImpl extends BaseDaoImpl<AdvertisingSpace> implements AdvertisingSpaceDao { public class AdvertisingSpaceDaoImpl extends BaseDaoImpl<AdvertisingSpace> implements AdvertisingSpaceDao {
/**
* 获取广告位信息
*/
@Override @Override
public AdvertisingSpaceDTO getDTOById(Long adId) { public AdvertisingSpaceDTO getDTOById(Long adId) {
return super.getSqlSession().selectOne(getStatement("getDTOById"), adId); return super.getSqlSession().selectOne(getStatement("getDTOById"), adId);
} }
/**
* 书刊广告位明细
*/
@Override
public List<AdvertisingSpaceDTO> advertisingDetail4Book(Map<String, Object> paramMap) {
return super.getSqlSession().selectList(getStatement("advertisingDetail4Book"), paramMap);
}
/**
* 微信群广告位明细
*/
@Override
public List<AdvertisingSpaceDTO> advertisingDetail4WechatGroup(Map<String, Object> paramMap) {
return super.getSqlSession().selectList(getStatement("advertisingDetail4WechatGroup"), paramMap);
}
/**
* 广告主广告位明细
*/
@Override
public List<AdvertisingSpaceDTO> advertisingDetail4Master(Map<String, Object> paramMap) {
return super.getSqlSession().selectList(getStatement("advertisingDetail4Master"), paramMap);
}
/**
* 获取书刊下的广告位列表
*/
@Override
public List<AdvertisingSpaceDTO> getDTOByBookId(Map<String, Object> paramMap) {
return super.getSqlSession().selectList(getStatement("getDTOByBookId"), paramMap);
}
} }
package com.pcloud.book.advertising.dto;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.common.dto.BaseDto;
public class AdvertisingMasterDTO extends BaseDto {
private static final long serialVersionUID = -2269268659722737438L;
/**
* advertising_master.id (唯一标识)
*/
private Long id;
/**
* advertising_master.master_name (广告主名称)
*/
private String masterName;
/**
* advertising_master.create_time (创建时间)
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/**
* advertising_master.update_time (修改时间)
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
/**
* 广告结算方式列表
*/
private List<AdvertisingSettlementMethodDTO> settlementMethodList;
/**
* 广告位数量
*/
private Long spaceNum;
/**
* 曝光量
*/
private Long exposureNum;
/**
* 点击量
*/
private Long clickNum;
/**
* 点击率
*/
private BigDecimal clickRate;
/**
* 累积消费
*/
private BigDecimal totalIncome;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getMasterName() {
return masterName;
}
public void setMasterName(String masterName) {
this.masterName = masterName;
}
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public List<AdvertisingSettlementMethodDTO> getSettlementMethodList() {
return settlementMethodList;
}
public void setSettlementMethodList(List<AdvertisingSettlementMethodDTO> settlementMethodList) {
this.settlementMethodList = settlementMethodList;
}
public Long getSpaceNum() {
return spaceNum;
}
public void setSpaceNum(Long spaceNum) {
this.spaceNum = spaceNum;
}
public Long getExposureNum() {
return exposureNum;
}
public void setExposureNum(Long exposureNum) {
this.exposureNum = exposureNum;
}
public Long getClickNum() {
return clickNum;
}
public void setClickNum(Long clickNum) {
this.clickNum = clickNum;
}
public BigDecimal getClickRate() {
return clickRate;
}
public void setClickRate(BigDecimal clickRate) {
this.clickRate = clickRate;
}
public BigDecimal getTotalIncome() {
return totalIncome;
}
public void setTotalIncome(BigDecimal totalIncome) {
this.totalIncome = totalIncome;
}
@Override
public String toString() {
return "AdvertisingMasterDTO{" +
"id=" + id +
", masterName='" + masterName + '\'' +
", createTime=" + createTime +
", updateTime=" + updateTime +
", settlementMethodList=" + settlementMethodList +
", spaceNum=" + spaceNum +
", exposureNum=" + exposureNum +
", clickNum=" + clickNum +
", clickRate=" + clickRate +
", totalIncome=" + totalIncome +
"} " + super.toString();
}
}
\ No newline at end of file
package com.pcloud.book.advertising.dto;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.common.dto.BaseDto;
public class AdvertisingSettlementMethodDTO extends BaseDto {
private static final long serialVersionUID = 8723754417913443287L;
/**
* advertising_settlement_method.id (唯一标识)
*/
private Long id;
/**
* advertising_settlement_method.master_id (广告主ID)
*/
private Long masterId;
/**
* advertising_settlement_method.ad_id (广告位ID)
*/
private Long adId;
/**
* advertising_settlement_method.settlement_method (结算方式)
*/
private String settlementMethod;
/**
* 结算方式名称
*/
private String settlementMethodName;
/**
* advertising_settlement_method.price_each_time (每次价格)
*/
private BigDecimal priceEachTime;
/**
* advertising_settlement_method.create_time (创建时间)
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/**
* advertising_settlement_method.update_time (修改时间)
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getMasterId() {
return masterId;
}
public void setMasterId(Long masterId) {
this.masterId = masterId;
}
public Long getAdId() {
return adId;
}
public void setAdId(Long adId) {
this.adId = adId;
}
public String getSettlementMethod() {
return settlementMethod;
}
public void setSettlementMethod(String settlementMethod) {
this.settlementMethod = settlementMethod;
}
public String getSettlementMethodName() {
return settlementMethodName;
}
public void setSettlementMethodName(String settlementMethodName) {
this.settlementMethodName = settlementMethodName;
}
public BigDecimal getPriceEachTime() {
return priceEachTime;
}
public void setPriceEachTime(BigDecimal priceEachTime) {
this.priceEachTime = priceEachTime;
}
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "AdvertisingSettlementMethodDTO{" +
"id=" + id +
", masterId=" + masterId +
", adId=" + adId +
", settlementMethod='" + settlementMethod + '\'' +
", settlementMethodName='" + settlementMethodName + '\'' +
", priceEachTime=" + priceEachTime +
", createTime=" + createTime +
", updateTime=" + updateTime +
"} " + super.toString();
}
}
\ No newline at end of file
package com.pcloud.book.advertising.dto; package com.pcloud.book.advertising.dto;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.common.dto.BaseDto; import com.pcloud.common.dto.BaseDto;
...@@ -27,44 +28,54 @@ public class AdvertisingSpaceDTO extends BaseDto { ...@@ -27,44 +28,54 @@ public class AdvertisingSpaceDTO extends BaseDto {
private String adPosition; private String adPosition;
/** /**
* advertising_space.ad_source (广告来源) * advertising_space.ad_position_mode (广告位置方式)
*/ */
private String adSource; private String adPositionMode;
/** /**
* advertising_space.ad_link (广告位链接) * advertising_space.ad_position_detail (具体广告位置)
*/ */
private String adLink; private String adPositionDetail;
/** /**
* advertising_space.source_id (对方id) * 广告位置名称
*/ */
private String sourceId; private String adPositionName;
/** /**
* advertising_space.ad_slogan (广告位文案) * advertising_space.master_id (广告主ID)
*/ */
private String adSlogan; private Long masterId;
/** /**
* advertising_space.ad_pic (广告位图片) * 广告主名称
*/ */
private String adPic; private String masterName;
/** /**
* advertising_space.distribution_type (投放方式(0:指定书刊;1:不指定书刊)) * advertising_space.ad_link (广告位链接)
*/ */
private Integer distributionType; private String adLink;
/** /**
* advertising_space.exposure_num (曝光量) * advertising_space.source_id (对方id)
*/ */
private Long exposureNum; private String sourceId;
/** /**
* advertising_space.click_num (点击量) * advertising_space.ad_title (广告位标题)
*/ */
private Long clickNum; private String adTitle;
/**
* advertising_space.ad_slogan (广告位文案)
*/
private String adSlogan;
/**
* advertising_space.ad_pic (广告位图片)
*/
private String adPic;
/** /**
* advertising_space.create_time (创建时间) * advertising_space.create_time (创建时间)
...@@ -98,6 +109,87 @@ public class AdvertisingSpaceDTO extends BaseDto { ...@@ -98,6 +109,87 @@ public class AdvertisingSpaceDTO extends BaseDto {
*/ */
private Long bookId; private Long bookId;
/**
* 曝光量
*/
private Long exposureNum;
/**
* 点击量
*/
private Long clickNum;
/**
* 点击读者量
*/
private Long clickUserNum;
/**
* 点击率
*/
private BigDecimal clickRate;
/**
* 累积消费
*/
private BigDecimal totalIncome;
/**
* 结算方式
*/
private String settlementMethod;
/**
* 结算方式名称
*/
private String settlementMethodName;
/**
* 每次价格
*/
private BigDecimal priceEachTime;
/**
* 投放时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date distributionTime;
/**
* 微信群ID
*/
private Long qrcodeId;
/**
* 微信群名称
*/
private String groupQrcodeName;
/**
* 书号
*/
private String isbn;
/**
* 出版社ID
*/
private Long agentId;
/**
* 出版社名称
*/
private String agentName;
/**
* 编辑ID
*/
private Long adviserId;
/**
* 运营ID
*/
private Long channelId;
public Long getId() { public Long getId() {
return id; return id;
} }
...@@ -122,14 +214,6 @@ public class AdvertisingSpaceDTO extends BaseDto { ...@@ -122,14 +214,6 @@ public class AdvertisingSpaceDTO extends BaseDto {
this.adPosition = adPosition; this.adPosition = adPosition;
} }
public String getAdSource() {
return adSource;
}
public void setAdSource(String adSource) {
this.adSource = adSource;
}
public String getAdLink() { public String getAdLink() {
return adLink; return adLink;
} }
...@@ -162,14 +246,6 @@ public class AdvertisingSpaceDTO extends BaseDto { ...@@ -162,14 +246,6 @@ public class AdvertisingSpaceDTO extends BaseDto {
this.adPic = adPic; this.adPic = adPic;
} }
public Integer getDistributionType() {
return distributionType;
}
public void setDistributionType(Integer distributionType) {
this.distributionType = distributionType;
}
public Long getExposureNum() { public Long getExposureNum() {
return exposureNum; return exposureNum;
} }
...@@ -236,26 +312,205 @@ public class AdvertisingSpaceDTO extends BaseDto { ...@@ -236,26 +312,205 @@ public class AdvertisingSpaceDTO extends BaseDto {
this.bookId = bookId; this.bookId = bookId;
} }
public String getAdPositionMode() {
return adPositionMode;
}
public void setAdPositionMode(String adPositionMode) {
this.adPositionMode = adPositionMode;
}
public String getAdPositionDetail() {
return adPositionDetail;
}
public void setAdPositionDetail(String adPositionDetail) {
this.adPositionDetail = adPositionDetail;
}
public Long getMasterId() {
return masterId;
}
public void setMasterId(Long masterId) {
this.masterId = masterId;
}
public String getAdTitle() {
return adTitle;
}
public void setAdTitle(String adTitle) {
this.adTitle = adTitle;
}
public String getMasterName() {
return masterName;
}
public void setMasterName(String masterName) {
this.masterName = masterName;
}
public BigDecimal getClickRate() {
return clickRate;
}
public void setClickRate(BigDecimal clickRate) {
this.clickRate = clickRate;
}
public BigDecimal getTotalIncome() {
return totalIncome;
}
public void setTotalIncome(BigDecimal totalIncome) {
this.totalIncome = totalIncome;
}
public String getSettlementMethod() {
return settlementMethod;
}
public void setSettlementMethod(String settlementMethod) {
this.settlementMethod = settlementMethod;
}
public String getSettlementMethodName() {
return settlementMethodName;
}
public void setSettlementMethodName(String settlementMethodName) {
this.settlementMethodName = settlementMethodName;
}
public BigDecimal getPriceEachTime() {
return priceEachTime;
}
public void setPriceEachTime(BigDecimal priceEachTime) {
this.priceEachTime = priceEachTime;
}
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
public Date getDistributionTime() {
return distributionTime;
}
public void setDistributionTime(Date distributionTime) {
this.distributionTime = distributionTime;
}
public String getAdPositionName() {
return adPositionName;
}
public void setAdPositionName(String adPositionName) {
this.adPositionName = adPositionName;
}
public Long getQrcodeId() {
return qrcodeId;
}
public void setQrcodeId(Long qrcodeId) {
this.qrcodeId = qrcodeId;
}
public String getGroupQrcodeName() {
return groupQrcodeName;
}
public void setGroupQrcodeName(String groupQrcodeName) {
this.groupQrcodeName = groupQrcodeName;
}
public String getIsbn() {
return isbn;
}
public void setIsbn(String isbn) {
this.isbn = isbn;
}
public Long getAgentId() {
return agentId;
}
public void setAgentId(Long agentId) {
this.agentId = agentId;
}
public String getAgentName() {
return agentName;
}
public void setAgentName(String agentName) {
this.agentName = agentName;
}
public Long getAdviserId() {
return adviserId;
}
public void setAdviserId(Long adviserId) {
this.adviserId = adviserId;
}
public Long getChannelId() {
return channelId;
}
public void setChannelId(Long channelId) {
this.channelId = channelId;
}
public Long getClickUserNum() {
return clickUserNum;
}
public void setClickUserNum(Long clickUserNum) {
this.clickUserNum = clickUserNum;
}
@Override @Override
public String toString() { public String toString() {
return "AdvertisingSpaceDTO{" + return "AdvertisingSpaceDTO{" +
"id=" + id + "id=" + id +
", adName='" + adName + '\'' + ", adName='" + adName + '\'' +
", adPosition='" + adPosition + '\'' + ", adPosition='" + adPosition + '\'' +
", adSource='" + adSource + '\'' + ", adPositionMode='" + adPositionMode + '\'' +
", adPositionDetail='" + adPositionDetail + '\'' +
", adPositionName='" + adPositionName + '\'' +
", masterId=" + masterId +
", masterName='" + masterName + '\'' +
", adLink='" + adLink + '\'' + ", adLink='" + adLink + '\'' +
", sourceId='" + sourceId + '\'' + ", sourceId='" + sourceId + '\'' +
", adTitle='" + adTitle + '\'' +
", adSlogan='" + adSlogan + '\'' + ", adSlogan='" + adSlogan + '\'' +
", adPic='" + adPic + '\'' + ", adPic='" + adPic + '\'' +
", distributionType=" + distributionType +
", exposureNum=" + exposureNum +
", clickNum=" + clickNum +
", createTime=" + createTime + ", createTime=" + createTime +
", updateTime=" + updateTime + ", updateTime=" + updateTime +
", isOpen=" + isOpen + ", isOpen=" + isOpen +
", bookNum=" + bookNum + ", bookNum=" + bookNum +
", bookName='" + bookName + '\'' + ", bookName='" + bookName + '\'' +
", bookId=" + bookId + ", bookId=" + bookId +
", exposureNum=" + exposureNum +
", clickNum=" + clickNum +
", clickUserNum=" + clickUserNum +
", clickRate=" + clickRate +
", totalIncome=" + totalIncome +
", settlementMethod='" + settlementMethod + '\'' +
", settlementMethodName='" + settlementMethodName + '\'' +
", priceEachTime=" + priceEachTime +
", distributionTime=" + distributionTime +
", qrcodeId=" + qrcodeId +
", groupQrcodeName='" + groupQrcodeName + '\'' +
", isbn='" + isbn + '\'' +
", agentId=" + agentId +
", agentName='" + agentName + '\'' +
", adviserId=" + adviserId +
", channelId=" + channelId +
"} " + super.toString(); "} " + super.toString();
} }
} }
\ No newline at end of file
package com.pcloud.book.advertising.dto; package com.pcloud.book.advertising.dto;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonInclude;
/** /**
* @description 日期数量DTO * @description 日期数量DTO
...@@ -8,6 +10,7 @@ import java.io.Serializable; ...@@ -8,6 +10,7 @@ import java.io.Serializable;
* @date 2017年6月11日 下午2:08:30 * @date 2017年6月11日 下午2:08:30
* @version 1.0 * @version 1.0
*/ */
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class DateCountDTO implements Serializable { public class DateCountDTO implements Serializable {
private static final long serialVersionUID = 4234798666223706295L; private static final long serialVersionUID = 4234798666223706295L;
...@@ -27,6 +30,11 @@ public class DateCountDTO implements Serializable { ...@@ -27,6 +30,11 @@ public class DateCountDTO implements Serializable {
*/ */
private Long clickNum; private Long clickNum;
/**
* 收益
*/
private BigDecimal income;
public String getDate() { public String getDate() {
return date; return date;
} }
...@@ -50,4 +58,22 @@ public class DateCountDTO implements Serializable { ...@@ -50,4 +58,22 @@ public class DateCountDTO implements Serializable {
public void setClickNum(Long clickNum) { public void setClickNum(Long clickNum) {
this.clickNum = clickNum; this.clickNum = clickNum;
} }
public BigDecimal getIncome() {
return income;
}
public void setIncome(BigDecimal income) {
this.income = income;
}
@Override
public String toString() {
return "DateCountDTO{" +
"date='" + date + '\'' +
", exposureNum=" + exposureNum +
", clickNum=" + clickNum +
", income=" + income +
'}';
}
} }
package com.pcloud.book.advertising.dto;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.common.dto.BaseDto;
/**
* @author PENG
*/
public class WechatGroupClickUserDTO extends BaseDto {
private static final long serialVersionUID = -2385429387988628595L;
/**
* 广告位ID
*/
private Long adId;
/**
* 公众号ID
*/
private Long officialAccountId;
/**
* 来源类型
*/
private String fromType;
/**
* 来源ID
*/
private Long fromId;
/**
* 读者ID
*/
private Long wechatUserId;
/**
* 读者昵称
*/
private String wechatUserName;
/**
* 读者头像
*/
private String wechatUserHeadurl;
/**
* 性别
*/
private Integer wechatUserSex;
/**
* 省份
*/
private String wechatUserProvince;
/**
* 城市
*/
private String wechatUserCity;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
public Long getAdId() {
return adId;
}
public void setAdId(Long adId) {
this.adId = adId;
}
public Long getOfficialAccountId() {
return officialAccountId;
}
public void setOfficialAccountId(Long officialAccountId) {
this.officialAccountId = officialAccountId;
}
public String getFromType() {
return fromType;
}
public void setFromType(String fromType) {
this.fromType = fromType;
}
public Long getFromId() {
return fromId;
}
public void setFromId(Long fromId) {
this.fromId = fromId;
}
public Long getWechatUserId() {
return wechatUserId;
}
public void setWechatUserId(Long wechatUserId) {
this.wechatUserId = wechatUserId;
}
public String getWechatUserName() {
return wechatUserName;
}
public void setWechatUserName(String wechatUserName) {
this.wechatUserName = wechatUserName;
}
public String getWechatUserHeadurl() {
return wechatUserHeadurl;
}
public void setWechatUserHeadurl(String wechatUserHeadurl) {
this.wechatUserHeadurl = wechatUserHeadurl;
}
public Integer getWechatUserSex() {
return wechatUserSex;
}
public void setWechatUserSex(Integer wechatUserSex) {
this.wechatUserSex = wechatUserSex;
}
public String getWechatUserProvince() {
return wechatUserProvince;
}
public void setWechatUserProvince(String wechatUserProvince) {
this.wechatUserProvince = wechatUserProvince;
}
public String getWechatUserCity() {
return wechatUserCity;
}
public void setWechatUserCity(String wechatUserCity) {
this.wechatUserCity = wechatUserCity;
}
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public String toString() {
return "WechatGroupClickUserDTO{" +
"adId=" + adId +
", officialAccountId=" + officialAccountId +
", fromType='" + fromType + '\'' +
", fromId=" + fromId +
", wechatUserId=" + wechatUserId +
", wechatUserName='" + wechatUserName + '\'' +
", wechatUserHeadurl='" + wechatUserHeadurl + '\'' +
", wechatUserSex=" + wechatUserSex +
", wechatUserProvince='" + wechatUserProvince + '\'' +
", wechatUserCity='" + wechatUserCity + '\'' +
", createTime=" + createTime +
"} " + super.toString();
}
}
\ No newline at end of file
...@@ -26,6 +26,11 @@ public class AdvertisingClickRecord extends BaseEntity { ...@@ -26,6 +26,11 @@ public class AdvertisingClickRecord extends BaseEntity {
private Long bookId; private Long bookId;
/** /**
* advertising_click_record.is_book_group (是否是社群书)
*/
private Boolean isBookGroup;
/**
* 二维码ID * 二维码ID
*/ */
private Long sceneId; private Long sceneId;
...@@ -75,6 +80,16 @@ public class AdvertisingClickRecord extends BaseEntity { ...@@ -75,6 +80,16 @@ public class AdvertisingClickRecord extends BaseEntity {
*/ */
private Date createDay; private Date createDay;
/**
* 创建月份
*/
private String createMonth;
/**
* 社群码ID
*/
private Long bookGroupId;
@Override @Override
public Long getId() { public Long getId() {
return id; return id;
...@@ -101,6 +116,14 @@ public class AdvertisingClickRecord extends BaseEntity { ...@@ -101,6 +116,14 @@ public class AdvertisingClickRecord extends BaseEntity {
this.bookId = bookId; this.bookId = bookId;
} }
public Boolean getIsBookGroup() {
return isBookGroup;
}
public void setIsBookGroup(Boolean isBookGroup) {
this.isBookGroup = isBookGroup;
}
public Long getAdviserId() { public Long getAdviserId() {
return adviserId; return adviserId;
} }
...@@ -183,12 +206,29 @@ public class AdvertisingClickRecord extends BaseEntity { ...@@ -183,12 +206,29 @@ public class AdvertisingClickRecord extends BaseEntity {
this.sceneId = sceneId; this.sceneId = sceneId;
} }
public String getCreateMonth() {
return createMonth;
}
public void setCreateMonth(String createMonth) {
this.createMonth = createMonth;
}
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
@Override @Override
public String toString() { public String toString() {
return "AdvertisingClickRecord{" + return "AdvertisingClickRecord{" +
"id=" + id + "id=" + id +
", adId=" + adId + ", adId=" + adId +
", bookId=" + bookId + ", bookId=" + bookId +
", isBookGroup=" + isBookGroup +
", sceneId=" + sceneId + ", sceneId=" + sceneId +
", adviserId=" + adviserId + ", adviserId=" + adviserId +
", agentId=" + agentId + ", agentId=" + agentId +
...@@ -199,6 +239,8 @@ public class AdvertisingClickRecord extends BaseEntity { ...@@ -199,6 +239,8 @@ public class AdvertisingClickRecord extends BaseEntity {
", wechatUserId=" + wechatUserId + ", wechatUserId=" + wechatUserId +
", createTime=" + createTime + ", createTime=" + createTime +
", createDay=" + createDay + ", createDay=" + createDay +
", createMonth='" + createMonth + '\'' +
", bookGroupId=" + bookGroupId +
"} " + super.toString(); "} " + super.toString();
} }
} }
\ No newline at end of file
...@@ -43,19 +43,34 @@ public class AdvertisingDistributionBook extends BaseEntity { ...@@ -43,19 +43,34 @@ public class AdvertisingDistributionBook extends BaseEntity {
private Long channelId; private Long channelId;
/** /**
* advertising_distribution_book.is_book_group (是否是社群书)
*/
private Boolean isBookGroup;
/**
* advertising_distribution_book.classify_id (群分类ID)
*/
private Long classifyId;
/**
* advertising_distribution_book.qrcode_id (微信群ID)
*/
private Long qrcodeId;
/**
* advertising_distribution_book.distribution_time (投放时间) * advertising_distribution_book.distribution_time (投放时间)
*/ */
private Date distributionTime; private Date distributionTime;
/** /**
* 书刊ID列表 * 书刊列表
*/ */
private List<BookAdviser> books; private List<BookAdviser> books;
/** /**
* 投放方式(0:指定书刊;1:不指定书刊) * 微信群列表
*/ */
private Integer distributionType; private List<DistributionWechatGroup> groups;
@Override @Override
public Long getId() { public Long getId() {
...@@ -107,6 +122,30 @@ public class AdvertisingDistributionBook extends BaseEntity { ...@@ -107,6 +122,30 @@ public class AdvertisingDistributionBook extends BaseEntity {
this.channelId = channelId; this.channelId = channelId;
} }
public Boolean getIsBookGroup() {
return isBookGroup;
}
public void setIsBookGroup(Boolean isBookGroup) {
this.isBookGroup = isBookGroup;
}
public Long getClassifyId() {
return classifyId;
}
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public Long getQrcodeId() {
return qrcodeId;
}
public void setQrcodeId(Long qrcodeId) {
this.qrcodeId = qrcodeId;
}
public Date getDistributionTime() { public Date getDistributionTime() {
return distributionTime; return distributionTime;
} }
...@@ -123,12 +162,12 @@ public class AdvertisingDistributionBook extends BaseEntity { ...@@ -123,12 +162,12 @@ public class AdvertisingDistributionBook extends BaseEntity {
this.books = books; this.books = books;
} }
public Integer getDistributionType() { public List<DistributionWechatGroup> getGroups() {
return distributionType; return groups;
} }
public void setDistributionType(Integer distributionType) { public void setGroups(List<DistributionWechatGroup> groups) {
this.distributionType = distributionType; this.groups = groups;
} }
@Override @Override
...@@ -140,9 +179,12 @@ public class AdvertisingDistributionBook extends BaseEntity { ...@@ -140,9 +179,12 @@ public class AdvertisingDistributionBook extends BaseEntity {
", adviserId=" + adviserId + ", adviserId=" + adviserId +
", agentId=" + agentId + ", agentId=" + agentId +
", channelId=" + channelId + ", channelId=" + channelId +
", isBookGroup=" + isBookGroup +
", classifyId=" + classifyId +
", qrcodeId=" + qrcodeId +
", distributionTime=" + distributionTime + ", distributionTime=" + distributionTime +
", books=" + books + ", books=" + books +
", distributionType=" + distributionType + ", groups=" + groups +
"} " + super.toString(); "} " + super.toString();
} }
} }
\ No newline at end of file
...@@ -26,6 +26,11 @@ public class AdvertisingExposureRecord extends BaseEntity { ...@@ -26,6 +26,11 @@ public class AdvertisingExposureRecord extends BaseEntity {
private Long bookId; private Long bookId;
/** /**
* advertising_exposure_record.is_book_group (是否是社群书)
*/
private Boolean isBookGroup;
/**
* 二维码ID * 二维码ID
*/ */
private Long sceneId; private Long sceneId;
...@@ -75,6 +80,16 @@ public class AdvertisingExposureRecord extends BaseEntity { ...@@ -75,6 +80,16 @@ public class AdvertisingExposureRecord extends BaseEntity {
*/ */
private Date createDay; private Date createDay;
/**
* 创建月份
*/
private String createMonth;
/**
* 曝光次数
*/
private Long count;
@Override @Override
public Long getId() { public Long getId() {
return id; return id;
...@@ -101,6 +116,14 @@ public class AdvertisingExposureRecord extends BaseEntity { ...@@ -101,6 +116,14 @@ public class AdvertisingExposureRecord extends BaseEntity {
this.bookId = bookId; this.bookId = bookId;
} }
public Boolean getIsBookGroup() {
return isBookGroup;
}
public void setIsBookGroup(Boolean isBookGroup) {
this.isBookGroup = isBookGroup;
}
public Long getAdviserId() { public Long getAdviserId() {
return adviserId; return adviserId;
} }
...@@ -183,12 +206,29 @@ public class AdvertisingExposureRecord extends BaseEntity { ...@@ -183,12 +206,29 @@ public class AdvertisingExposureRecord extends BaseEntity {
this.sceneId = sceneId; this.sceneId = sceneId;
} }
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
public String getCreateMonth() {
return createMonth;
}
public void setCreateMonth(String createMonth) {
this.createMonth = createMonth;
}
@Override @Override
public String toString() { public String toString() {
return "AdvertisingExposureRecord{" + return "AdvertisingExposureRecord{" +
"id=" + id + "id=" + id +
", adId=" + adId + ", adId=" + adId +
", bookId=" + bookId + ", bookId=" + bookId +
", isBookGroup=" + isBookGroup +
", sceneId=" + sceneId + ", sceneId=" + sceneId +
", adviserId=" + adviserId + ", adviserId=" + adviserId +
", agentId=" + agentId + ", agentId=" + agentId +
...@@ -199,6 +239,8 @@ public class AdvertisingExposureRecord extends BaseEntity { ...@@ -199,6 +239,8 @@ public class AdvertisingExposureRecord extends BaseEntity {
", wechatUserId=" + wechatUserId + ", wechatUserId=" + wechatUserId +
", createTime=" + createTime + ", createTime=" + createTime +
", createDay=" + createDay + ", createDay=" + createDay +
", createMonth='" + createMonth + '\'' +
", count=" + count +
"} " + super.toString(); "} " + super.toString();
} }
} }
\ No newline at end of file
package com.pcloud.book.advertising.entity;
import java.math.BigDecimal;
import java.util.Date;
import com.pcloud.common.entity.BaseEntity;
public class AdvertisingIncomeDaily extends BaseEntity {
private static final long serialVersionUID = 2993939729052080207L;
/**
* advertising_income_daily.id (唯一标识)
*/
private Long id;
/**
* advertising_income_daily.ad_id (广告位ID)
*/
private Long adId;
/**
* advertising_income_daily.master_id (广告主ID)
*/
private Long masterId;
/**
* advertising_income_daily.book_id (书刊ID)
*/
private Long bookId;
/**
* 运营ID
*/
private Long channelId;
/**
* advertising_income_daily.classify_id (分类ID)
*/
private Long classifyId;
/**
* advertising_income_daily.qrcode_id (微信群ID)
*/
private Long qrcodeId;
/**
* advertising_income_daily.settlement_method (结算方式编码)
*/
private String settlementMethod;
/**
* advertising_income_daily.price_each_time (价格)
*/
private BigDecimal priceEachTime;
/**
* advertising_income_daily.exposure_num (曝光量)
*/
private Integer exposureNum;
/**
* advertising_income_daily.click_num (点击量)
*/
private Integer clickNum;
/**
* advertising_income_daily.income (收益)
*/
private BigDecimal income;
/**
* advertising_income_daily.create_time (创建时间)
*/
private Date createTime;
/**
* advertising_income_daily.statis_day (统计日期)
*/
private Date statisDay;
/**
* advertising_income_daily.statis_month (统计月份)
*/
private String statisMonth;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getAdId() {
return adId;
}
public void setAdId(Long adId) {
this.adId = adId;
}
public Long getMasterId() {
return masterId;
}
public void setMasterId(Long masterId) {
this.masterId = masterId;
}
public Long getBookId() {
return bookId;
}
public void setBookId(Long bookId) {
this.bookId = bookId;
}
public Long getChannelId() {
return channelId;
}
public void setChannelId(Long channelId) {
this.channelId = channelId;
}
public Long getClassifyId() {
return classifyId;
}
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public Long getQrcodeId() {
return qrcodeId;
}
public void setQrcodeId(Long qrcodeId) {
this.qrcodeId = qrcodeId;
}
public String getSettlementMethod() {
return settlementMethod;
}
public void setSettlementMethod(String settlementMethod) {
this.settlementMethod = settlementMethod;
}
public BigDecimal getPriceEachTime() {
return priceEachTime;
}
public void setPriceEachTime(BigDecimal priceEachTime) {
this.priceEachTime = priceEachTime;
}
public Integer getExposureNum() {
return exposureNum;
}
public void setExposureNum(Integer exposureNum) {
this.exposureNum = exposureNum;
}
public Integer getClickNum() {
return clickNum;
}
public void setClickNum(Integer clickNum) {
this.clickNum = clickNum;
}
public BigDecimal getIncome() {
return income;
}
public void setIncome(BigDecimal income) {
this.income = income;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getStatisDay() {
return statisDay;
}
public void setStatisDay(Date statisDay) {
this.statisDay = statisDay;
}
public String getStatisMonth() {
return statisMonth;
}
public void setStatisMonth(String statisMonth) {
this.statisMonth = statisMonth;
}
@Override
public String toString() {
return "AdvertisingIncomeDaily{" +
"id=" + id +
", adId=" + adId +
", masterId=" + masterId +
", bookId=" + bookId +
", channelId=" + channelId +
", classifyId=" + classifyId +
", qrcodeId=" + qrcodeId +
", settlementMethod='" + settlementMethod + '\'' +
", priceEachTime=" + priceEachTime +
", exposureNum=" + exposureNum +
", clickNum=" + clickNum +
", income=" + income +
", createTime=" + createTime +
", statisDay=" + statisDay +
", statisMonth='" + statisMonth + '\'' +
"} " + super.toString();
}
}
\ No newline at end of file
package com.pcloud.book.advertising.entity;
import java.util.Date;
import java.util.List;
import com.pcloud.common.entity.BaseEntity;
public class AdvertisingMaster extends BaseEntity {
private static final long serialVersionUID = 3317585726581741831L;
/**
* advertising_master.id (唯一标识)
*/
private Long id;
/**
* advertising_master.master_name (广告主名称)
*/
private String masterName;
/**
* advertising_master.create_time (创建时间)
*/
private Date createTime;
/**
* advertising_master.update_time (修改时间)
*/
private Date updateTime;
/**
* 广告结算方式列表
*/
private List<AdvertisingSettlementMethod> settlementMethodList;
@Override
public Long getId() {
return id;
}
@Override
public void setId(Long id) {
this.id = id;
}
public String getMasterName() {
return masterName;
}
public void setMasterName(String masterName) {
this.masterName = masterName;
}
@Override
public Date getCreateTime() {
return createTime;
}
@Override
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public Date getUpdateTime() {
return updateTime;
}
@Override
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public List<AdvertisingSettlementMethod> getSettlementMethodList() {
return settlementMethodList;
}
public void setSettlementMethodList(List<AdvertisingSettlementMethod> settlementMethodList) {
this.settlementMethodList = settlementMethodList;
}
@Override
public String toString() {
return "AdvertisingMaster{" +
"id=" + id +
", masterName='" + masterName + '\'' +
", createTime=" + createTime +
", updateTime=" + updateTime +
", settlementMethodList=" + settlementMethodList +
"} " + super.toString();
}
}
\ No newline at end of file
package com.pcloud.book.advertising.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import com.pcloud.common.entity.BaseEntity;
public class AdvertisingSettlementMethod extends BaseEntity {
private static final long serialVersionUID = 2834986141520977079L;
/**
* advertising_settlement_method.id (唯一标识)
*/
private Long id;
/**
* advertising_settlement_method.master_id (广告主ID)
*/
private Long masterId;
/**
* advertising_settlement_method.ad_id (广告位ID)
*/
private Long adId;
/**
* advertising_settlement_method.settlement_method (结算方式)
*/
private String settlementMethod;
/**
* advertising_settlement_method.price_each_time (每次价格)
*/
private BigDecimal priceEachTime;
/**
* advertising_settlement_method.create_time (创建时间)
*/
private Date createTime;
/**
* advertising_settlement_method.update_time (修改时间)
*/
private Date updateTime;
@Override
public Long getId() {
return id;
}
@Override
public void setId(Long id) {
this.id = id;
}
public Long getMasterId() {
return masterId;
}
public void setMasterId(Long masterId) {
this.masterId = masterId;
}
public Long getAdId() {
return adId;
}
public void setAdId(Long adId) {
this.adId = adId;
}
public String getSettlementMethod() {
return settlementMethod;
}
public void setSettlementMethod(String settlementMethod) {
this.settlementMethod = settlementMethod;
}
public BigDecimal getPriceEachTime() {
return priceEachTime;
}
public void setPriceEachTime(BigDecimal priceEachTime) {
this.priceEachTime = priceEachTime;
}
@Override
public Date getCreateTime() {
return createTime;
}
@Override
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public Date getUpdateTime() {
return updateTime;
}
@Override
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "AdvertisingSettlementMethod{" +
"id=" + id +
", masterId=" + masterId +
", adId=" + adId +
", settlementMethod='" + settlementMethod + '\'' +
", priceEachTime=" + priceEachTime +
", createTime=" + createTime +
", updateTime=" + updateTime +
"} " + super.toString();
}
}
\ No newline at end of file
package com.pcloud.book.advertising.entity; package com.pcloud.book.advertising.entity;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import com.pcloud.common.entity.BaseEntity; import com.pcloud.common.entity.BaseEntity;
...@@ -26,9 +27,19 @@ public class AdvertisingSpace extends BaseEntity { ...@@ -26,9 +27,19 @@ public class AdvertisingSpace extends BaseEntity {
private String adPosition; private String adPosition;
/** /**
* advertising_space.ad_source (广告来源) * advertising_space.ad_position_mode (广告位置方式)
*/ */
private String adSource; private String adPositionMode;
/**
* advertising_space.ad_position_detail (具体广告位置)
*/
private String adPositionDetail;
/**
* advertising_space.master_id (广告主ID)
*/
private Long masterId;
/** /**
* advertising_space.ad_link (广告位链接) * advertising_space.ad_link (广告位链接)
...@@ -41,6 +52,11 @@ public class AdvertisingSpace extends BaseEntity { ...@@ -41,6 +52,11 @@ public class AdvertisingSpace extends BaseEntity {
private String sourceId; private String sourceId;
/** /**
* advertising_space.ad_title (广告位标题)
*/
private String adTitle;
/**
* advertising_space.ad_slogan (广告位文案) * advertising_space.ad_slogan (广告位文案)
*/ */
private String adSlogan; private String adSlogan;
...@@ -51,11 +67,6 @@ public class AdvertisingSpace extends BaseEntity { ...@@ -51,11 +67,6 @@ public class AdvertisingSpace extends BaseEntity {
private String adPic; private String adPic;
/** /**
* advertising_space.distribution_type (投放方式(0:指定书刊;1:不指定书刊))
*/
private Integer distributionType;
/**
* advertising_space.create_time (创建时间) * advertising_space.create_time (创建时间)
*/ */
private Date createTime; private Date createTime;
...@@ -70,6 +81,16 @@ public class AdvertisingSpace extends BaseEntity { ...@@ -70,6 +81,16 @@ public class AdvertisingSpace extends BaseEntity {
*/ */
private Boolean isOpen; private Boolean isOpen;
/**
* 结算方式
*/
private String settlementMethod;
/**
* 每次价格
*/
private BigDecimal priceEachTime;
@Override @Override
public Long getId() { public Long getId() {
return id; return id;
...@@ -96,12 +117,28 @@ public class AdvertisingSpace extends BaseEntity { ...@@ -96,12 +117,28 @@ public class AdvertisingSpace extends BaseEntity {
this.adPosition = adPosition; this.adPosition = adPosition;
} }
public String getAdSource() { public String getAdPositionMode() {
return adSource; return adPositionMode;
}
public void setAdPositionMode(String adPositionMode) {
this.adPositionMode = adPositionMode;
}
public String getAdPositionDetail() {
return adPositionDetail;
}
public void setAdPositionDetail(String adPositionDetail) {
this.adPositionDetail = adPositionDetail;
} }
public void setAdSource(String adSource) { public Long getMasterId() {
this.adSource = adSource; return masterId;
}
public void setMasterId(Long masterId) {
this.masterId = masterId;
} }
public String getAdLink() { public String getAdLink() {
...@@ -120,6 +157,14 @@ public class AdvertisingSpace extends BaseEntity { ...@@ -120,6 +157,14 @@ public class AdvertisingSpace extends BaseEntity {
this.sourceId = sourceId; this.sourceId = sourceId;
} }
public String getAdTitle() {
return adTitle;
}
public void setAdTitle(String adTitle) {
this.adTitle = adTitle;
}
public String getAdSlogan() { public String getAdSlogan() {
return adSlogan; return adSlogan;
} }
...@@ -136,14 +181,6 @@ public class AdvertisingSpace extends BaseEntity { ...@@ -136,14 +181,6 @@ public class AdvertisingSpace extends BaseEntity {
this.adPic = adPic; this.adPic = adPic;
} }
public Integer getDistributionType() {
return distributionType;
}
public void setDistributionType(Integer distributionType) {
this.distributionType = distributionType;
}
@Override @Override
public Date getCreateTime() { public Date getCreateTime() {
return createTime; return createTime;
...@@ -172,21 +209,41 @@ public class AdvertisingSpace extends BaseEntity { ...@@ -172,21 +209,41 @@ public class AdvertisingSpace extends BaseEntity {
this.isOpen = isOpen; this.isOpen = isOpen;
} }
public String getSettlementMethod() {
return settlementMethod;
}
public void setSettlementMethod(String settlementMethod) {
this.settlementMethod = settlementMethod;
}
public BigDecimal getPriceEachTime() {
return priceEachTime;
}
public void setPriceEachTime(BigDecimal priceEachTime) {
this.priceEachTime = priceEachTime;
}
@Override @Override
public String toString() { public String toString() {
return "AdvertisingSpace{" + return "AdvertisingSpace{" +
"id=" + id + "id=" + id +
", adName='" + adName + '\'' + ", adName='" + adName + '\'' +
", adPosition='" + adPosition + '\'' + ", adPosition='" + adPosition + '\'' +
", adSource='" + adSource + '\'' + ", adPositionMode='" + adPositionMode + '\'' +
", adPositionDetail='" + adPositionDetail + '\'' +
", masterId=" + masterId +
", adLink='" + adLink + '\'' + ", adLink='" + adLink + '\'' +
", sourceId='" + sourceId + '\'' + ", sourceId='" + sourceId + '\'' +
", adTitle='" + adTitle + '\'' +
", adSlogan='" + adSlogan + '\'' + ", adSlogan='" + adSlogan + '\'' +
", adPic='" + adPic + '\'' + ", adPic='" + adPic + '\'' +
", distributionType=" + distributionType +
", createTime=" + createTime + ", createTime=" + createTime +
", updateTime=" + updateTime + ", updateTime=" + updateTime +
", isOpen=" + isOpen + ", isOpen=" + isOpen +
", settlementMethod='" + settlementMethod + '\'' +
", priceEachTime=" + priceEachTime +
"} " + super.toString(); "} " + super.toString();
} }
} }
\ No newline at end of file
package com.pcloud.book.advertising.entity;
import java.io.Serializable;
/**
* Description 投放微信学习群参数实体
* Created by PENG on 2019/5/9.
*/
public class DistributionWechatGroup implements Serializable {
private static final long serialVersionUID = 7843545114166726847L;
/**
* 书刊ID
*/
private Long bookId;
/**
* 运营ID
*/
private Long channelId;
/**
* 编辑ID
*/
private Long adviserId;
/**
* 群分类ID
*/
private Long classifyId;
/**
* 微信群ID
*/
private Long qrcodeId;
public Long getBookId() {
return bookId;
}
public void setBookId(Long bookId) {
this.bookId = bookId;
}
public Long getChannelId() {
return channelId;
}
public void setChannelId(Long channelId) {
this.channelId = channelId;
}
public Long getAdviserId() {
return adviserId;
}
public void setAdviserId(Long adviserId) {
this.adviserId = adviserId;
}
public Long getClassifyId() {
return classifyId;
}
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public Long getQrcodeId() {
return qrcodeId;
}
public void setQrcodeId(Long qrcodeId) {
this.qrcodeId = qrcodeId;
}
@Override
public String toString() {
return "DistributionWechatGroup{" +
"bookId=" + bookId +
", channelId=" + channelId +
", adviserId=" + adviserId +
", classifyId=" + classifyId +
", qrcodeId=" + qrcodeId +
'}';
}
}
package com.pcloud.book.advertising.enums;
/**
* Description 具体广告位置枚举
* @author PENG
* @date 2019/4/24
*/
public enum AdPositionDetailEnum {
JOIN_PAGE(AdPositionEnum.BOOK_GROUP_PAGE.positionCode, "JOIN_PAGE", "入群选择页"),
GROUP_QRCODE_PAGE(AdPositionEnum.BOOK_GROUP_PAGE.positionCode, "GROUP_QRCODE_PAGE", "群二维码页面"),
FAIL_JOIN_PAGE(AdPositionEnum.BOOK_GROUP_PAGE.positionCode, "FAIL_JOIN_PAGE", "群成员已满/无法入群页面");
public final String positionCode;
public final String detailCode;
public final String detailName;
AdPositionDetailEnum(String positionCode, String detailCode, String detailName) {
this.positionCode = positionCode;
this.detailCode = detailCode;
this.detailName = detailName;
}
/**
* 校验位置是否存在
*/
public static Boolean checkCodeExist(String positionCode, String detailCode) {
AdPositionDetailEnum[] var1 = values();
int var2 = var1.length;
for (int var3 = 0; var3 < var2; ++var3) {
AdPositionDetailEnum adPositionDetailEnum = var1[var3];
if (adPositionDetailEnum.positionCode.equals(positionCode) && adPositionDetailEnum.detailCode.equals(detailCode)) {
return true;
}
}
return false;
}
/**
* 根据编码拿名称
*/
public static String getNameByCode(String detailCode) {
AdPositionDetailEnum[] var1 = values();
int var2 = var1.length;
for (int var3 = 0; var3 < var2; ++var3) {
AdPositionDetailEnum adPositionDetailEnum = var1[var3];
if (adPositionDetailEnum.detailCode.equals(detailCode)) {
return adPositionDetailEnum.detailName;
}
}
return "";
}
}
...@@ -7,24 +7,18 @@ package com.pcloud.book.advertising.enums; ...@@ -7,24 +7,18 @@ package com.pcloud.book.advertising.enums;
*/ */
public enum AdPositionEnum { public enum AdPositionEnum {
/** BOOK_GROUP_PAGE("BOOK_GROUP_PAGE", "扫社群码页面"),
* 应用或作品详情浮标
*/
DETAIL_PAGE("DETAIL_PAGE", "应用或作品详情浮标", true),
/** APP_OR_PRODUCT("APP_OR_PRODUCT", "具体应用/作品"),
* 扫码消息
*/ WECHAT_GROUP_MSG("WECHAT_GROUP_MSG", "微信群消息");
SCENE_MESSAGE("SCENE_MESSAGE", "扫码消息", false);
public final String positionCode; public final String positionCode;
public final String positionName; public final String positionName;
public final Boolean isOpen;
AdPositionEnum(String positionCode, String positionName, Boolean isOpen) { AdPositionEnum(String positionCode, String positionName) {
this.positionCode = positionCode; this.positionCode = positionCode;
this.positionName = positionName; this.positionName = positionName;
this.isOpen = isOpen;
} }
/** /**
...@@ -35,12 +29,27 @@ public enum AdPositionEnum { ...@@ -35,12 +29,27 @@ public enum AdPositionEnum {
int var2 = var1.length; int var2 = var1.length;
for (int var3 = 0; var3 < var2; ++var3) { for (int var3 = 0; var3 < var2; ++var3) {
AdPositionEnum adPositionEnum = var1[var3]; AdPositionEnum adPositionEnum = var1[var3];
if (adPositionEnum.positionCode.equals(positionCode) && adPositionEnum.isOpen) { if (adPositionEnum.positionCode.equals(positionCode)) {
return true; return true;
} }
} }
return false; return false;
} }
public static final String[] AD_POSITION_GATHER = {DETAIL_PAGE.positionCode, SCENE_MESSAGE.positionCode}; /**
* 根据编码拿名称
*/
public static String getNameByCode(String positionCode) {
AdPositionEnum[] var1 = values();
int var2 = var1.length;
for (int var3 = 0; var3 < var2; ++var3) {
AdPositionEnum adPositionEnum = var1[var3];
if (adPositionEnum.positionCode.equals(positionCode)) {
return adPositionEnum.positionName;
}
}
return "";
}
public static final String[] AD_POSITION_GATHER = {BOOK_GROUP_PAGE.positionCode, APP_OR_PRODUCT.positionCode, WECHAT_GROUP_MSG.positionCode};
} }
package com.pcloud.book.advertising.enums;
/**
* Description 广告形式枚举类
* Created by PENG on 2019/4/24.
*/
public enum AdPositionModeEnum {
INFORMATION(AdPositionEnum.BOOK_GROUP_PAGE.positionCode, AdPositionDetailEnum.JOIN_PAGE.detailCode, "INFORMATION", "信息流"),
BANNER_MIDDLE(AdPositionEnum.BOOK_GROUP_PAGE.positionCode, AdPositionDetailEnum.JOIN_PAGE.detailCode, "BANNER_MIDDLE", "中部通栏"),
BANNER_BOTTOM(AdPositionEnum.BOOK_GROUP_PAGE.positionCode, AdPositionDetailEnum.GROUP_QRCODE_PAGE.detailCode, "BANNER_BOTTOM", "底部通栏"),
BANNER_BOTTOM_TRACK(AdPositionEnum.BOOK_GROUP_PAGE.positionCode, AdPositionDetailEnum.FAIL_JOIN_PAGE.detailCode, "BANNER_BOTTOM_TRACK", "底部通栏(跑道式)"),
DESC_PAGE_HEAD(AdPositionEnum.APP_OR_PRODUCT.positionCode, null, "DESC_PAGE_HEAD", "应用说明页头部通栏"),
DESC_PAGE_MIDDLE(AdPositionEnum.APP_OR_PRODUCT.positionCode, null, "DESC_PAGE_MIDDLE", "应用说明页中部通栏"),
DESC_PAGE_BOTTOM(AdPositionEnum.APP_OR_PRODUCT.positionCode, null, "DESC_PAGE_BOTTOM", "应用说明页底部通栏"),
TOP_FOCUS_PIC_1(AdPositionEnum.APP_OR_PRODUCT.positionCode, null, "TOP_FOCUS_PIC_1", "顶部焦点图第1帧"),
TOP_FOCUS_PIC_2(AdPositionEnum.APP_OR_PRODUCT.positionCode, null, "TOP_FOCUS_PIC_2", "顶部焦点图第2帧"),
UNDER_TITLE_BANNER(AdPositionEnum.APP_OR_PRODUCT.positionCode, null, "UNDER_TITLE_BANNER", "顶部焦点图第2帧"),
RIGHT_FLOAT_ICON(AdPositionEnum.APP_OR_PRODUCT.positionCode, null, "RIGHT_FLOAT_ICON", "右侧浮标"),
PAY_POP_UP(AdPositionEnum.APP_OR_PRODUCT.positionCode, null, "PAY_POP_UP", "付费后弹窗"),
MINE_TOP_BANNER(AdPositionEnum.APP_OR_PRODUCT.positionCode, null, "MINE_TOP_BANNER", "“我的”顶部通栏(大)"),
TOP_BANNER_SMALL(AdPositionEnum.APP_OR_PRODUCT.positionCode, null, "TOP_BANNER_SMALL", "顶部通栏(小)"),
BOTTOM_FLOAT_ICON(AdPositionEnum.APP_OR_PRODUCT.positionCode, null, "BOTTOM_FLOAT_ICON", "底部浮标"),
BOTTOM_BANNER_LARGE(AdPositionEnum.APP_OR_PRODUCT.positionCode, null, "BOTTOM_BANNER_LARGE", "底部通栏(大)"),
PAY_BOTTOM_BANNER(AdPositionEnum.APP_OR_PRODUCT.positionCode, null, "PAY_BOTTOM_BANNER", "应用支付页底部通栏"),
PIC_IN_PIC_MIDDLE(AdPositionEnum.APP_OR_PRODUCT.positionCode, null, "PIC_IN_PIC_MIDDLE", "画中画(中)"),
PIC_IN_PIC_BOTTOM(AdPositionEnum.APP_OR_PRODUCT.positionCode, null, "PIC_IN_PIC_BOTTOM", "画中画(底)"),
TEXT_AND_LINK(AdPositionEnum.WECHAT_GROUP_MSG.positionCode, null, "TEXT_AND_LINK", "文字+链接"),
NEWS_SHARE(AdPositionEnum.WECHAT_GROUP_MSG.positionCode, null, "NEWS_SHARE", "图文分享"),
JUST_PIC(AdPositionEnum.WECHAT_GROUP_MSG.positionCode, null, "JUST_PIC", "纯图片");
public final String positionCode;
public final String detailCode;
public final String modeCode;
public final String modeName;
AdPositionModeEnum(String positionCode, String detailCode, String modeCode, String modeName) {
this.positionCode = positionCode;
this.detailCode = detailCode;
this.modeCode = modeCode;
this.modeName = modeName;
}
/**
* 校验位置是否存在
*/
public static Boolean checkCodeExist(String positionCode, String modeCode) {
AdPositionModeEnum[] var1 = values();
int var2 = var1.length;
for (int var3 = 0; var3 < var2; ++var3) {
AdPositionModeEnum adPositionModeEnum = var1[var3];
if (adPositionModeEnum.positionCode.equals(positionCode) && adPositionModeEnum.modeCode.equals(modeCode)) {
return true;
}
}
return false;
}
/**
* 根据编码拿名称
*/
public static String getNameByCode(String modeCode) {
AdPositionModeEnum[] var1 = values();
int var2 = var1.length;
for (int var3 = 0; var3 < var2; ++var3) {
AdPositionModeEnum adPositionModeEnum = var1[var3];
if (adPositionModeEnum.modeCode.equals(modeCode)) {
return adPositionModeEnum.modeName;
}
}
return "";
}
}
package com.pcloud.book.advertising.enums;
/**
* Description 广告来源枚举
* @author PENG
* @date 2019/3/1
*/
public enum AdSourceEnum {
/**
* 推啊
*/
TUIA("TUIA"),
/**
* 招行
*/
CMB("CMB");
public String code;
AdSourceEnum(String code) {
this.code = code;
}
public static final String[] AD_SOURCE_GATHER = {TUIA.code, CMB.code};
}
package com.pcloud.book.advertising.enums;
/**
* Description 广告投放方式枚举
* @author PENG
* @date 2019/3/1
*/
public enum DistributionTypeEnum {
/**
* 指定书刊
*/
SIGN_BOOK(0),
/**
* 不指定书刊
*/
NO_SIGN_BOOK(1);
public Integer value;
DistributionTypeEnum(Integer value) {
this.value = value;
}
public static final Integer[] DISTRIBUTION_TYPE_GATHER = {SIGN_BOOK.value, NO_SIGN_BOOK.value};
}
package com.pcloud.book.advertising.enums;
/**
* Description 广告结算方式
* Created by PENG on 2019/4/26.
*/
public enum SettlementMethodEnum {
CPC("CPC", "按点击量"),
CPM("CPM", "按曝光量"),
CPA("CPA", "按实际行动"),
CPS("CPS", "按实际销售");
public final String code;
public final String name;
SettlementMethodEnum(String code, String name) {
this.code = code;
this.name = name;
}
public static String getNameByCode(String code) {
SettlementMethodEnum[] var1 = values();
int var2 = var1.length;
for (int var3 = 0; var3 < var2; ++var3) {
SettlementMethodEnum methodEnum = var1[var3];
if (methodEnum.code.equals(code)) {
return methodEnum.name;
}
}
return null;
}
public static final String[] SETTLEMENT_METHOD_GATHER = {CPC.code, CPM.code, CPA.code, CPS.code};
public static final String[] SETTLEMENT_METHOD_NEED_PRICE_GATHER = {CPC.code, CPM.code};
}
...@@ -13,6 +13,7 @@ import com.pcloud.book.advertising.entity.AdvertisingAgentPermission; ...@@ -13,6 +13,7 @@ import com.pcloud.book.advertising.entity.AdvertisingAgentPermission;
import com.pcloud.book.advertising.entity.AdvertisingClickRecord; import com.pcloud.book.advertising.entity.AdvertisingClickRecord;
import com.pcloud.book.advertising.entity.AdvertisingDistributionBook; import com.pcloud.book.advertising.entity.AdvertisingDistributionBook;
import com.pcloud.book.advertising.entity.AdvertisingExposureRecord; import com.pcloud.book.advertising.entity.AdvertisingExposureRecord;
import com.pcloud.book.advertising.entity.AdvertisingMaster;
import com.pcloud.book.advertising.entity.AdvertisingSpace; import com.pcloud.book.advertising.entity.AdvertisingSpace;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
...@@ -104,25 +105,25 @@ public interface AdvertisingSpaceFacade { ...@@ -104,25 +105,25 @@ public interface AdvertisingSpaceFacade {
throws PermissionException, BizException, JsonParseException; throws PermissionException, BizException, JsonParseException;
/** /**
* 删除广告位 * 投放书刊
* @param token 用户身份信息 * @param token 用户身份信息
* @param advertisingSpace 广告位实体 * @param advertisingDistributionBook 广告位书刊实体
* @return * @return
* @throws PermissionException * @throws PermissionException
* @throws BizException * @throws BizException
* @throws JsonParseException * @throws JsonParseException
*/ */
@ApiOperation(value = "删除广告位", httpMethod = "POST") @ApiOperation(value = "投放书刊", httpMethod = "POST")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "用户身份信息", required = false, dataType = "string", paramType = "header"), @ApiImplicitParam(name = "token", value = "用户身份信息", required = false, dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "advertisingSpace", value = "广告位实体", required = false, dataType = "AdvertisingSpace", paramType = "body") @ApiImplicitParam(name = "advertisingDistributionBook", value = "广告位书刊实体", required = false, dataType = "AdvertisingDistributionBook", paramType = "body")
}) })
@RequestMapping(value = "delete", method = RequestMethod.POST) @RequestMapping(value = "distributeBook", method = RequestMethod.POST)
ResponseDto<?> delete(@RequestHeader("token") String token, @RequestBody AdvertisingSpace advertisingSpace) ResponseDto<?> distributeBook(@RequestHeader("token") String token, @RequestBody AdvertisingDistributionBook advertisingDistributionBook)
throws PermissionException, BizException, JsonParseException; throws PermissionException, BizException, JsonParseException;
/** /**
* 投放书刊 * 投放微信群
* @param token 用户身份信息 * @param token 用户身份信息
* @param advertisingDistributionBook 广告位书刊实体 * @param advertisingDistributionBook 广告位书刊实体
* @return * @return
...@@ -130,13 +131,13 @@ public interface AdvertisingSpaceFacade { ...@@ -130,13 +131,13 @@ public interface AdvertisingSpaceFacade {
* @throws BizException * @throws BizException
* @throws JsonParseException * @throws JsonParseException
*/ */
@ApiOperation(value = "投放书刊", httpMethod = "POST") @ApiOperation(value = "投放微信群", httpMethod = "POST")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "用户身份信息", required = false, dataType = "string", paramType = "header"), @ApiImplicitParam(name = "token", value = "用户身份信息", required = false, dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "advertisingDistributionBook", value = "广告位书刊实体", required = false, dataType = "AdvertisingDistributionBook", paramType = "body") @ApiImplicitParam(name = "advertisingDistributionBook", value = "广告位书刊实体", required = false, dataType = "AdvertisingDistributionBook", paramType = "body")
}) })
@RequestMapping(value = "distributeBook", method = RequestMethod.POST) @RequestMapping(value = "distributeWechatGroup", method = RequestMethod.POST)
ResponseDto<?> distributeBook(@RequestHeader("token") String token, @RequestBody AdvertisingDistributionBook advertisingDistributionBook) ResponseDto<?> distributeWechatGroup(@RequestHeader("token") String token, @RequestBody AdvertisingDistributionBook advertisingDistributionBook)
throws PermissionException, BizException, JsonParseException; throws PermissionException, BizException, JsonParseException;
/** /**
...@@ -215,11 +216,12 @@ public interface AdvertisingSpaceFacade { ...@@ -215,11 +216,12 @@ public interface AdvertisingSpaceFacade {
/** /**
* 平台端获取某编辑书刊列表 * 平台端获取某编辑书刊列表
* @param token 用户身份信息 * @param token 用户身份信息
* @param adviserId 编辑ID * @param adviserId 编辑ID
* @param name 书籍名称 * @param name 书籍名称
* @param currentPage 当前页 * @param currentPage 当前页
* @param numPerPage 每页条数 * @param numPerPage 每页条数
* @param bookGroupOnly 是否社群书
* @return * @return
* @throws PermissionException * @throws PermissionException
* @throws BizException * @throws BizException
...@@ -230,12 +232,36 @@ public interface AdvertisingSpaceFacade { ...@@ -230,12 +232,36 @@ public interface AdvertisingSpaceFacade {
@ApiImplicitParam(name = "adviserId", value = "编辑ID", dataType = "Long", paramType = "query"), @ApiImplicitParam(name = "adviserId", value = "编辑ID", dataType = "Long", paramType = "query"),
@ApiImplicitParam(name = "name", value = "书籍名称", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "name", value = "书籍名称", dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "int", paramType = "query"), @ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "int", paramType = "query"),
@ApiImplicitParam(name = "numPerPage", value = "每页条数", dataType = "int", paramType = "query") @ApiImplicitParam(name = "numPerPage", value = "每页条数", dataType = "int", paramType = "query"),
@ApiImplicitParam(name = "bookGroupOnly", value = "是否社群书", dataType = "boolean", paramType = "query")
}) })
@RequestMapping(value = "listBook4Platform", method = RequestMethod.GET) @RequestMapping(value = "listBook4Platform", method = RequestMethod.GET)
ResponseDto<?> listBook4Platform(@RequestHeader("token") String token, @RequestParam(value = "adviserId", required = false) Long adviserId, ResponseDto<?> listBook4Platform(@RequestHeader("token") String token, @RequestParam(value = "adviserId", required = false) Long adviserId,
@RequestParam(value = "name", required = false) String name, @RequestParam(value = "currentPage", required = false) Integer currentPage, @RequestParam(value = "name", required = false) String name, @RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage) throws PermissionException, BizException, JsonParseException; @RequestParam(value = "numPerPage", required = false) Integer numPerPage, @RequestParam(value = "bookGroupOnly", required = false) Boolean bookGroupOnly)
throws PermissionException, BizException, JsonParseException;
/**
* 平台端获取社群书微信群列表
* @param token 用户身份信息
* @param name 书籍名称
* @param currentPage 当前页
* @param numPerPage 每页条数
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation(value = "平台端获取社群书微信群列表", httpMethod = "GET")
@ApiImplicitParams({@ApiImplicitParam(name = "token", value = "token", dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "name", value = "书籍名称", dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "int", paramType = "query"),
@ApiImplicitParam(name = "numPerPage", value = "每页条数", dataType = "int", paramType = "query")
})
@RequestMapping(value = "listGroupQrcode4Platform", method = RequestMethod.GET)
ResponseDto<?> listGroupQrcode4Platform(@RequestHeader("token") String token, @RequestParam(value = "name", required = false) String name,
@RequestParam(value = "currentPage", required = false) Integer currentPage, @RequestParam(value = "numPerPage", required = false) Integer numPerPage)
throws PermissionException, BizException, JsonParseException;
/** /**
* 获取广告位列表 * 获取广告位列表
...@@ -284,9 +310,10 @@ public interface AdvertisingSpaceFacade { ...@@ -284,9 +310,10 @@ public interface AdvertisingSpaceFacade {
@RequestParam(value = "numPerPage", required = false) Integer numPerPage) throws PermissionException, BizException, JsonParseException; @RequestParam(value = "numPerPage", required = false) Integer numPerPage) throws PermissionException, BizException, JsonParseException;
/** /**
* 获取广告位投放作品/应用数据统计 * 获取广告位投放微信群列表
* @param token 用户身份信息 * @param token 用户身份信息
* @param adId 广告位ID * @param adId 广告位ID
* @param name 名称
* @param currentPage 当前页 * @param currentPage 当前页
* @param numPerPage 每页条数 * @param numPerPage 每页条数
* @return * @return
...@@ -294,49 +321,52 @@ public interface AdvertisingSpaceFacade { ...@@ -294,49 +321,52 @@ public interface AdvertisingSpaceFacade {
* @throws BizException * @throws BizException
* @throws JsonParseException * @throws JsonParseException
*/ */
@ApiOperation(value = "获取广告位投放作品/应用数据统计", httpMethod = "GET") @ApiOperation(value = "获取广告位投放微信群列表", httpMethod = "GET")
@ApiImplicitParams({@ApiImplicitParam(name = "token", value = "token", dataType = "string", paramType = "header"), @ApiImplicitParams({@ApiImplicitParam(name = "token", value = "token", dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "adId", value = "广告位ID", dataType = "Long", paramType = "query"), @ApiImplicitParam(name = "adId", value = "广告位ID", dataType = "Long", paramType = "query"),
@ApiImplicitParam(name = "name", value = "名称", dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "int", paramType = "query"), @ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "int", paramType = "query"),
@ApiImplicitParam(name = "numPerPage", value = "每页条数", dataType = "int", paramType = "query") @ApiImplicitParam(name = "numPerPage", value = "每页条数", dataType = "int", paramType = "query")
}) })
@RequestMapping(value = "distributionAppStatics", method = RequestMethod.GET) @RequestMapping(value = "distributionWechatGroupList", method = RequestMethod.GET)
ResponseDto<?> distributionAppStatics(@RequestHeader("token") String token, @RequestParam(value = "adId", required = false) Long adId, ResponseDto<?> distributionWechatGroupList(@RequestHeader("token") String token, @RequestParam(value = "adId", required = false) Long adId,
@RequestParam(value = "currentPage", required = false) Integer currentPage, @RequestParam(value = "numPerPage", required = false) Integer numPerPage) @RequestParam(value = "name", required = false) String name, @RequestParam(value = "currentPage", required = false) Integer currentPage,
throws PermissionException, BizException, JsonParseException; @RequestParam(value = "numPerPage", required = false) Integer numPerPage) throws PermissionException, BizException, JsonParseException;
/** /**
* 获取广告位投放时间统计 * 获取书刊配置的广告位信息
* @param token 用户身份信息 * @param userInfo 用户身份信息
* @param adId 广告位ID * @param adPositionDetail 广告具体位置
* @param day 天数
* @return * @return
* @throws PermissionException * @throws PermissionException
* @throws BizException * @throws BizException
* @throws JsonParseException * @throws JsonParseException
*/ */
@ApiOperation(value = "获取广告位投放时间统计", httpMethod = "GET") @ApiOperation(value = "获取书刊配置的广告位信息", httpMethod = "GET")
@ApiImplicitParams({@ApiImplicitParam(name = "token", value = "token", dataType = "string", paramType = "header"), @ApiImplicitParams({
@ApiImplicitParam(name = "adId", value = "广告位ID", dataType = "Long", paramType = "query"), @ApiImplicitParam(name = "userInfo", value = "用户身份信息", dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "day", value = "天数", dataType = "Long", paramType = "query") @ApiImplicitParam(name = "adPositionDetail", value = "广告具体位置", dataType = "string", paramType = "query"),
}) })
@RequestMapping(value = "distributionDateStatics", method = RequestMethod.GET) @RequestMapping(value = "get4Wechat", method = RequestMethod.GET)
ResponseDto<?> distributionDateStatics(@RequestHeader("token") String token, @RequestParam(value = "adId", required = false) Long adId, ResponseDto<?> get4Wechat(@CookieValue("userInfo") String userInfo, @RequestParam(value = "adPositionDetail", required = false) String adPositionDetail)
@RequestParam(value = "day", required = false) Integer day) throws PermissionException, BizException, JsonParseException; throws PermissionException, BizException, JsonParseException;
/** /**
* 获取书刊配置的广告位信息 * 获取社群书配置的广告位信息
* @param userInfo 用户身份信息 * @param userInfo 用户身份信息
* @param adPositionDetail 广告具体位置
* @return * @return
* @throws PermissionException * @throws PermissionException
* @throws BizException * @throws BizException
* @throws JsonParseException * @throws JsonParseException
*/ */
@ApiOperation(value = "获取书刊配置的广告位信息", httpMethod = "GET") @ApiOperation(value = "获取社群书配置的广告位信息", httpMethod = "GET")
@ApiImplicitParams({@ApiImplicitParam(name = "userInfo", value = "用户身份信息", dataType = "string", paramType = "header") @ApiImplicitParams({
@ApiImplicitParam(name = "userInfo", value = "用户身份信息", dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "adPositionDetail", value = "广告具体位置", dataType = "string", paramType = "query"),
}) })
@RequestMapping(value = "get4Wechat", method = RequestMethod.GET) @RequestMapping(value = "getBookGroupAd4Wechat", method = RequestMethod.GET)
ResponseDto<?> get4Wechat(@CookieValue("userInfo") String userInfo) ResponseDto<?> getBookGroupAd4Wechat(@CookieValue("userInfo") String userInfo, @RequestParam(value = "adPositionDetail", required = false) String adPositionDetail)
throws PermissionException, BizException, JsonParseException; throws PermissionException, BizException, JsonParseException;
/** /**
...@@ -374,4 +404,432 @@ public interface AdvertisingSpaceFacade { ...@@ -374,4 +404,432 @@ public interface AdvertisingSpaceFacade {
@RequestMapping(value = "addClickTrack", method = RequestMethod.POST) @RequestMapping(value = "addClickTrack", method = RequestMethod.POST)
ResponseDto<?> addClickTrack(@CookieValue("userInfo") String userInfo, @RequestBody AdvertisingClickRecord advertisingClickRecord) ResponseDto<?> addClickTrack(@CookieValue("userInfo") String userInfo, @RequestBody AdvertisingClickRecord advertisingClickRecord)
throws PermissionException, BizException, JsonParseException; throws PermissionException, BizException, JsonParseException;
/**
* 添加广告主
* @param token 用户身份信息
* @param advertisingMaster 广告主实体
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation(value = "添加广告主", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "用户身份信息", required = false, dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "advertisingMaster", value = "广告主实体", required = false, dataType = "AdvertisingMaster", paramType = "body")
})
@RequestMapping(value = "createMaster", method = RequestMethod.POST)
ResponseDto<?> createMaster(@RequestHeader("token") String token, @RequestBody AdvertisingMaster advertisingMaster)
throws PermissionException, BizException, JsonParseException;
/**
* 修改广告主
* @param token 用户身份信息
* @param advertisingMaster 广告主实体
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation(value = "修改广告主", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "用户身份信息", required = false, dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "advertisingMaster", value = "广告主实体", required = false, dataType = "AdvertisingMaster", paramType = "body")
})
@RequestMapping(value = "updateMaster", method = RequestMethod.POST)
ResponseDto<?> updateMaster(@RequestHeader("token") String token, @RequestBody AdvertisingMaster advertisingMaster)
throws PermissionException, BizException, JsonParseException;
/**
* 获取广告主列表
* @param token 用户身份信息
* @param masterName 广告主名称
* @param currentPage 当前页
* @param numPerPage 每页条数
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation(value = "获取广告主列表", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "用户身份信息", required = false, dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "masterName", value = "广告主名称", required = false, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "int", paramType = "query"),
@ApiImplicitParam(name = "numPerPage", value = "每页条数", dataType = "int", paramType = "query")
})
@RequestMapping(value = "getMasterList", method = RequestMethod.GET)
ResponseDto<?> getMasterList(@RequestHeader("token") String token, @RequestParam(value = "masterName", required = false) String masterName,
@RequestParam(value = "currentPage", required = false) Integer currentPage, @RequestParam(value = "numPerPage", required = false) Integer numPerPage)
throws PermissionException, BizException, JsonParseException;
/**
* 获取所有广告主
* @param token 用户身份信息
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation(value = "获取所有广告主", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "用户身份信息", required = false, dataType = "string", paramType = "header"),
})
@RequestMapping(value = "getAllMaster", method = RequestMethod.GET)
ResponseDto<?> getAllMaster(@RequestHeader("token") String token) throws PermissionException, BizException, JsonParseException;
/**
* 获取广告主信息
* @param token 用户身份信息
* @param masterId 广告主ID
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation(value = "获取广告主信息", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "用户身份信息", required = false, dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "masterId", value = "广告主ID", required = false, dataType = "Long", paramType = "query"),
})
@RequestMapping(value = "getMasterInfo", method = RequestMethod.GET)
ResponseDto<?> getMasterInfo(@RequestHeader("token") String token, @RequestParam(value = "masterId", required = false) Long masterId)
throws PermissionException, BizException, JsonParseException;
/**
* 获取概览数据
* @param token 用户身份信息
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation(value = "获取概览数据", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "用户身份信息", required = false, dataType = "string", paramType = "header"),
})
@RequestMapping(value = "overviewStatis", method = RequestMethod.GET)
ResponseDto<?> overviewStatis(@RequestHeader("token") String token) throws PermissionException, BizException, JsonParseException;
/**
* 获取流量趋势
* @param token 用户身份信息
* @param day 天数
* @param startDate 开始时间
* @param endDate 结束时间
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation(value = "获取流量趋势", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "用户身份信息", required = false, dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "day", value = "天数", required = false, dataType = "Integer", paramType = "query"),
@ApiImplicitParam(name = "startDate", value = "开始时间", required = false, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "endDate", value = "结束时间", required = false, dataType = "string", paramType = "query"),
})
@RequestMapping(value = "getFlowStatisTrend", method = RequestMethod.GET)
ResponseDto<?> getFlowStatisTrend(@RequestHeader("token") String token, @RequestParam(value = "day", required = false) Integer day,
@RequestParam(value = "startDate", required = false) String startDate, @RequestParam(value = "endDate", required = false) String endDate)
throws PermissionException, BizException, JsonParseException;
/**
* 获取收益趋势
* @param token 用户身份信息
* @param day 天数
* @param startDate 开始时间
* @param endDate 结束时间
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation(value = "获取收益趋势", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "用户身份信息", required = false, dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "day", value = "天数", required = false, dataType = "Integer", paramType = "query"),
@ApiImplicitParam(name = "startDate", value = "开始时间", required = false, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "endDate", value = "结束时间", required = false, dataType = "string", paramType = "query"),
})
@RequestMapping(value = "getIncomeStatisTrend", method = RequestMethod.GET)
ResponseDto<?> getIncomeStatisTrend(@RequestHeader("token") String token, @RequestParam(value = "day", required = false) Integer day,
@RequestParam(value = "startDate", required = false) String startDate, @RequestParam(value = "endDate", required = false) String endDate)
throws PermissionException, BizException, JsonParseException;
/**
* 获取广告位投放书刊列表
* @param token 用户身份信息
* @param name 书刊名称
* @param currentPage 当前页
* @param numPerPage 每页条数
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation(value = "获取广告位投放书刊列表", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "name", value = "书刊名称", dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "int", paramType = "query"),
@ApiImplicitParam(name = "numPerPage", value = "每页条数", dataType = "int", paramType = "query")
})
@RequestMapping(value = "advertisingBookList", method = RequestMethod.GET)
ResponseDto<?> advertisingBookList(@RequestHeader("token") String token, @RequestParam(value = "name", required = false) String name,
@RequestParam(value = "currentPage", required = false) Integer currentPage, @RequestParam(value = "numPerPage", required = false) Integer numPerPage)
throws PermissionException, BizException, JsonParseException;
/**
* 获取广告位投放微信群列表
* @param token 用户身份信息
* @param name 书刊名称
* @param currentPage 当前页
* @param numPerPage 每页条数
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation(value = "获取广告位投放微信群列表", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "name", value = "书刊名称", dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "int", paramType = "query"),
@ApiImplicitParam(name = "numPerPage", value = "每页条数", dataType = "int", paramType = "query")
})
@RequestMapping(value = "advertisingWechatGroupList", method = RequestMethod.GET)
ResponseDto<?> advertisingWechatGroupList(@RequestHeader("token") String token, @RequestParam(value = "name", required = false) String name,
@RequestParam(value = "currentPage", required = false) Integer currentPage, @RequestParam(value = "numPerPage", required = false) Integer numPerPage)
throws PermissionException, BizException, JsonParseException;
/**
* 获取广告位投放微信群曝光量前几位
* @param token 用户身份信息
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation(value = "获取广告位投放微信群曝光量前几位", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", dataType = "string", paramType = "header")
})
@RequestMapping(value = "advertisingWechatGroupRankTop", method = RequestMethod.GET)
ResponseDto<?> advertisingWechatGroupRankTop(@RequestHeader("token") String token) throws PermissionException, BizException, JsonParseException;
/**
* 书刊广告位明细
* @param token 用户身份信息
* @param bookId 书刊ID
* @param channelId 运营ID
* @param adviserId 编辑ID
* @param statisMonth 统计月份
* @param currentPage 当前页
* @param numPerPage 每页条数
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation(value = "书刊广告位明细", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "bookId", value = "书刊ID", dataType = "Long", paramType = "query"),
@ApiImplicitParam(name = "channelId", value = "运营ID", dataType = "Long", paramType = "query"),
@ApiImplicitParam(name = "adviserId", value = "编辑ID", dataType = "Long", paramType = "query"),
@ApiImplicitParam(name = "statisMonth", value = "统计月份", dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "int", paramType = "query"),
@ApiImplicitParam(name = "numPerPage", value = "每页条数", dataType = "int", paramType = "query")
})
@RequestMapping(value = "advertisingDetail4Book", method = RequestMethod.GET)
ResponseDto<?> advertisingDetail4Book(@RequestHeader("token") String token, @RequestParam(value = "bookId", required = false) Long bookId,
@RequestParam(value = "channelId", required = false) Long channelId, @RequestParam(value = "adviserId", required = false) Long adviserId,
@RequestParam(value = "statisMonth", required = false) String statisMonth, @RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage) throws PermissionException, BizException, JsonParseException;
/**
* 导出书刊广告位明细
* @param token 用户身份信息
* @param bookId 书刊ID
* @param channelId 运营ID
* @param adviserId 编辑ID
* @param statisMonth 统计月份
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation(value = "导出书刊广告位明细", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "bookId", value = "书刊ID", dataType = "Long", paramType = "query"),
@ApiImplicitParam(name = "channelId", value = "运营ID", dataType = "Long", paramType = "query"),
@ApiImplicitParam(name = "adviserId", value = "编辑ID", dataType = "Long", paramType = "query"),
@ApiImplicitParam(name = "statisMonth", value = "统计月份", dataType = "String", paramType = "query")
})
@RequestMapping(value = "exportAdvertisingDetail4Book", method = RequestMethod.GET)
ResponseDto<?> exportAdvertisingDetail4Book(@RequestHeader("token") String token, @RequestParam(value = "bookId", required = false) Long bookId,
@RequestParam(value = "channelId", required = false) Long channelId, @RequestParam(value = "adviserId", required = false) Long adviserId,
@RequestParam(value = "statisMonth", required = false) String statisMonth) throws PermissionException, BizException, JsonParseException;
/**
* 微信群广告位明细
* @param token 用户身份信息
* @param qrcodeId 微信群ID
* @param statisMonth 统计月份
* @param currentPage 当前页
* @param numPerPage 每页条数
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation(value = "微信群广告位明细", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "qrcodeId", value = "微信群ID", dataType = "Long", paramType = "query"),
@ApiImplicitParam(name = "statisMonth", value = "统计月份", dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "int", paramType = "query"),
@ApiImplicitParam(name = "numPerPage", value = "每页条数", dataType = "int", paramType = "query")
})
@RequestMapping(value = "advertisingDetail4WechatGroup", method = RequestMethod.GET)
ResponseDto<?> advertisingDetail4WechatGroup(@RequestHeader("token") String token, @RequestParam(value = "qrcodeId", required = false) Long qrcodeId,
@RequestParam(value = "statisMonth", required = false) String statisMonth, @RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage) throws PermissionException, BizException, JsonParseException;
/**
* 导出微信群广告位明细
* @param token 用户身份信息
* @param qrcodeId 微信群ID
* @param statisMonth 统计月份
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation(value = "导出微信群广告位明细", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "qrcodeId", value = "微信群ID", dataType = "Long", paramType = "query"),
@ApiImplicitParam(name = "statisMonth", value = "统计月份", dataType = "String", paramType = "query")
})
@RequestMapping(value = "exportAdvertisingDetail4WechatGroup", method = RequestMethod.GET)
ResponseDto<?> exportAdvertisingDetail4WechatGroup(@RequestHeader("token") String token, @RequestParam(value = "qrcodeId", required = false) Long qrcodeId,
@RequestParam(value = "statisMonth", required = false) String statisMonth) throws PermissionException, BizException, JsonParseException;
/**
* 微信群广告位点击读者列表
* @param token 用户身份信息
* @param qrcodeId 微信群ID
* @param adId 广告位ID
* @param statisMonth 统计月份
* @param currentPage 当前页
* @param numPerPage 每页条数
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation(value = "微信群广告位点击读者列表", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "qrcodeId", value = "微信群ID", dataType = "Long", paramType = "query"),
@ApiImplicitParam(name = "adId", value = "广告位ID", dataType = "Long", paramType = "query"),
@ApiImplicitParam(name = "statisMonth", value = "统计月份", dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "Integer", paramType = "query"),
@ApiImplicitParam(name = "numPerPage", value = "每页条数", dataType = "Integer", paramType = "query"),
})
@RequestMapping(value = "clickUserList4AdvertisingWechatGroup", method = RequestMethod.GET)
ResponseDto<?> clickUserList4AdvertisingWechatGroup(@RequestHeader("token") String token, @RequestParam(value = "qrcodeId", required = false) Long qrcodeId,
@RequestParam(value = "adId", required = false) Long adId, @RequestParam(value = "statisMonth", required = false) String statisMonth,
@RequestParam(value = "currentPage", required = false) Integer currentPage, @RequestParam(value = "numPerPage", required = false) Integer numPerPage)
throws PermissionException, BizException, JsonParseException;
/**
* 导出微信群广告位点击读者列表
* @param token 用户身份信息
* @param qrcodeId 微信群ID
* @param adId 广告位ID
* @param statisMonth 统计月份
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation(value = "导出微信群广告位点击读者列表", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "qrcodeId", value = "微信群ID", dataType = "Long", paramType = "query"),
@ApiImplicitParam(name = "adId", value = "广告位ID", dataType = "Long", paramType = "query"),
@ApiImplicitParam(name = "statisMonth", value = "统计月份", dataType = "String", paramType = "query"),
})
@RequestMapping(value = "exportClickUserList4AdvertisingWechatGroup", method = RequestMethod.GET)
ResponseDto<?> exportClickUserList4AdvertisingWechatGroup(@RequestHeader("token") String token, @RequestParam(value = "qrcodeId", required = false) Long qrcodeId,
@RequestParam(value = "adId", required = false) Long adId, @RequestParam(value = "statisMonth", required = false) String statisMonth)
throws PermissionException, BizException, JsonParseException;
/**
* 广告主广告位明细
* @param token 用户身份信息
* @param masterId 广告主ID
* @param statisMonth 统计月份
* @param currentPage 当前页
* @param numPerPage 每页条数
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation(value = "广告主广告位明细", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "masterId", value = "广告主ID", dataType = "Long", paramType = "query"),
@ApiImplicitParam(name = "statisMonth", value = "统计月份", dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "int", paramType = "query"),
@ApiImplicitParam(name = "numPerPage", value = "每页条数", dataType = "int", paramType = "query")
})
@RequestMapping(value = "advertisingDetail4Master", method = RequestMethod.GET)
ResponseDto<?> advertisingDetail4Master(@RequestHeader("token") String token, @RequestParam(value = "masterId", required = false) Long masterId,
@RequestParam(value = "statisMonth", required = false) String statisMonth, @RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage) throws PermissionException, BizException, JsonParseException;
/**
* 导出广告主广告位明细
* @param token 用户身份信息
* @param masterId 广告主ID
* @param statisMonth 统计月份
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation(value = "导出广告主广告位明细", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "masterId", value = "广告主ID", dataType = "Long", paramType = "query"),
@ApiImplicitParam(name = "statisMonth", value = "统计月份", dataType = "String", paramType = "query")
})
@RequestMapping(value = "exportAdvertisingDetail4Master", method = RequestMethod.GET)
ResponseDto<?> exportAdvertisingDetail4Master(@RequestHeader("token") String token, @RequestParam(value = "masterId", required = false) Long masterId,
@RequestParam(value = "statisMonth", required = false) String statisMonth) throws PermissionException, BizException, JsonParseException;
/**
* 获取微信群信息
* @param token 用户身份信息
* @param qrcodeId 微信群ID
* @return
* @throws PermissionException
* @throws BizException
* @throws JsonParseException
*/
@ApiOperation(value = "获取微信群信息", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "qrcodeId", value = "微信群ID", dataType = "Long", paramType = "query")
})
@RequestMapping(value = "getGroupQrcodeInfo", method = RequestMethod.GET)
ResponseDto<?> getGroupQrcodeInfo(@RequestHeader("token") String token, @RequestParam(value = "qrcodeId", required = false) Long qrcodeId)
throws PermissionException, BizException, JsonParseException;
} }
package com.pcloud.book.advertising.facade.impl; package com.pcloud.book.advertising.facade.impl;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.codehaus.jackson.JsonParseException; import org.codehaus.jackson.JsonParseException;
...@@ -18,6 +19,7 @@ import com.pcloud.book.advertising.entity.AdvertisingAgentPermission; ...@@ -18,6 +19,7 @@ import com.pcloud.book.advertising.entity.AdvertisingAgentPermission;
import com.pcloud.book.advertising.entity.AdvertisingClickRecord; import com.pcloud.book.advertising.entity.AdvertisingClickRecord;
import com.pcloud.book.advertising.entity.AdvertisingDistributionBook; import com.pcloud.book.advertising.entity.AdvertisingDistributionBook;
import com.pcloud.book.advertising.entity.AdvertisingExposureRecord; import com.pcloud.book.advertising.entity.AdvertisingExposureRecord;
import com.pcloud.book.advertising.entity.AdvertisingMaster;
import com.pcloud.book.advertising.entity.AdvertisingSpace; import com.pcloud.book.advertising.entity.AdvertisingSpace;
import com.pcloud.book.advertising.facade.AdvertisingSpaceFacade; import com.pcloud.book.advertising.facade.AdvertisingSpaceFacade;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
...@@ -102,31 +104,30 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade { ...@@ -102,31 +104,30 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade {
} }
/** /**
* 删除广告位 * 投放书刊
*/ */
@Override @Override
@RequestMapping(value = "delete", method = RequestMethod.POST) @RequestMapping(value = "distributeBook", method = RequestMethod.POST)
public ResponseDto<?> delete(@RequestHeader("token") String token, @RequestBody AdvertisingSpace advertisingSpace) public ResponseDto<?> distributeBook(@RequestHeader("token") String token, @RequestBody AdvertisingDistributionBook advertisingDistributionBook)
throws PermissionException, BizException, JsonParseException { throws PermissionException, BizException, JsonParseException {
if (null == advertisingSpace) { if (null == advertisingDistributionBook) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!");
} }
SessionUtil.getToken4Redis(token); advertisingSpaceBiz.distributeBook(advertisingDistributionBook);
advertisingSpaceBiz.delete(advertisingSpace);
return new ResponseDto<>(); return new ResponseDto<>();
} }
/** /**
* 投放书刊 * 投放微信群
*/ */
@Override @Override
@RequestMapping(value = "distributeBook", method = RequestMethod.POST) @RequestMapping(value = "distributeWechatGroup", method = RequestMethod.POST)
public ResponseDto<?> distributeBook(@RequestHeader("token") String token, @RequestBody AdvertisingDistributionBook advertisingDistributionBook) public ResponseDto<?> distributeWechatGroup(@RequestHeader("token") String token, @RequestBody AdvertisingDistributionBook advertisingDistributionBook)
throws PermissionException, BizException, JsonParseException { throws PermissionException, BizException, JsonParseException {
if (null == advertisingDistributionBook) { if (null == advertisingDistributionBook) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!");
} }
advertisingSpaceBiz.distributeBook(advertisingDistributionBook); advertisingSpaceBiz.distributeWechatGroup(advertisingDistributionBook);
return new ResponseDto<>(); return new ResponseDto<>();
} }
...@@ -203,21 +204,43 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade { ...@@ -203,21 +204,43 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade {
@RequestMapping(value = "listBook4Platform", method = RequestMethod.GET) @RequestMapping(value = "listBook4Platform", method = RequestMethod.GET)
public ResponseDto<?> listBook4Platform(@RequestHeader("token") String token, @RequestParam(value = "adviserId", required = false) Long adviserId, public ResponseDto<?> listBook4Platform(@RequestHeader("token") String token, @RequestParam(value = "adviserId", required = false) Long adviserId,
@RequestParam(value = "name", required = false) String name, @RequestParam(value = "currentPage", required = false) Integer currentPage, @RequestParam(value = "name", required = false) String name, @RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage) throws PermissionException, BizException, JsonParseException { @RequestParam(value = "numPerPage", required = false) Integer numPerPage, @RequestParam(value = "bookGroupOnly", required = false) Boolean bookGroupOnly)
throws PermissionException, BizException, JsonParseException {
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) { if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
throw BookBizException.PAGE_PARAM_DELETION; throw BookBizException.PAGE_PARAM_DELETION;
} }
if (null == adviserId) { /*if (null == adviserId) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!");
}*/
if (null == bookGroupOnly) {
bookGroupOnly = false;
} }
SessionUtil.getToken4Redis(token); SessionUtil.getToken4Redis(token);
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("adviserId", adviserId); paramMap.put("adviserId", adviserId);
paramMap.put("name", StringUtil.isEmpty(name) ? null : name); paramMap.put("name", StringUtil.isEmpty(name) ? null : name);
paramMap.put("bookGroupOnly", bookGroupOnly);
return new ResponseDto<>(advertisingSpaceBiz.listBook4Platform(paramMap, new PageParam(currentPage, numPerPage), adviserId)); return new ResponseDto<>(advertisingSpaceBiz.listBook4Platform(paramMap, new PageParam(currentPage, numPerPage), adviserId));
} }
/** /**
* 平台端获取社群书微信群列表
*/
@Override
@RequestMapping(value = "listGroupQrcode4Platform", method = RequestMethod.GET)
public ResponseDto<?> listGroupQrcode4Platform(@RequestHeader("token") String token, @RequestParam(value = "name", required = false) String name,
@RequestParam(value = "currentPage", required = false) Integer currentPage, @RequestParam(value = "numPerPage", required = false) Integer numPerPage)
throws PermissionException, BizException, JsonParseException {
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
throw BookBizException.PAGE_PARAM_DELETION;
}
SessionUtil.getToken4Redis(token);
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("name", StringUtil.isEmpty(name) ? null : name);
return new ResponseDto<>(advertisingSpaceBiz.listGroupQrcode4Platform(paramMap, new PageParam(currentPage, numPerPage)));
}
/**
* 获取广告位列表 * 获取广告位列表
*/ */
@Override @Override
...@@ -250,13 +273,13 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade { ...@@ -250,13 +273,13 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade {
} }
/** /**
* 获取广告位投放作品/应用数据统计 * 获取广告位投放微信群列表
*/ */
@Override @Override
@RequestMapping(value = "distributionAppStatics", method = RequestMethod.GET) @RequestMapping(value = "distributionWechatGroupList", method = RequestMethod.GET)
public ResponseDto<?> distributionAppStatics(@RequestHeader("token") String token, @RequestParam(value = "adId", required = false) Long adId, public ResponseDto<?> distributionWechatGroupList(@RequestHeader("token") String token, @RequestParam(value = "adId", required = false) Long adId,
@RequestParam(value = "currentPage", required = false) Integer currentPage, @RequestParam(value = "numPerPage", required = false) Integer numPerPage) @RequestParam(value = "name", required = false) String name, @RequestParam(value = "currentPage", required = false) Integer currentPage,
throws PermissionException, BizException, JsonParseException { @RequestParam(value = "numPerPage", required = false) Integer numPerPage) throws PermissionException, BizException, JsonParseException {
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) { if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
throw BookBizException.PAGE_PARAM_DELETION; throw BookBizException.PAGE_PARAM_DELETION;
} }
...@@ -264,40 +287,43 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade { ...@@ -264,40 +287,43 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!");
} }
SessionUtil.getToken4Redis(token); SessionUtil.getToken4Redis(token);
return new ResponseDto<>(advertisingSpaceBiz.distributionAppStatics(adId, new PageParam(currentPage, numPerPage))); return new ResponseDto<>(advertisingSpaceBiz.distributionWechatGroupList(adId, name, new PageParam(currentPage, numPerPage)));
} }
/** /**
* 获取广告位投放时间统计 * 获取书刊配置的广告位信息
*/ */
@Override @Override
@RequestMapping(value = "distributionDateStatics", method = RequestMethod.GET) @RequestMapping(value = "get4Wechat", method = RequestMethod.GET)
public ResponseDto<?> distributionDateStatics(@RequestHeader("token") String token, @RequestParam(value = "adId", required = false) Long adId, public ResponseDto<?> get4Wechat(@CookieValue("userInfo") String userInfo, @RequestParam(value = "adPositionDetail", required = false) String adPositionDetail)
@RequestParam(value = "day", required = false) Integer day) throws PermissionException, BizException, JsonParseException { throws PermissionException, BizException, JsonParseException {
if (null == adId) { if (StringUtil.isEmpty(adPositionDetail)) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!");
} }
SessionUtil.getToken4Redis(token); Long sceneId = Cookie.getId(userInfo, Cookie._SCENE_ID);
if (null == day) { Long adviserId = Cookie.getId(userInfo, Cookie._ADVISER_ID);
day = 7; Long channelId = Cookie.getId(userInfo, Cookie._CHANNEL_ID);
if (null == sceneId || null == adviserId || null == channelId) {
return new ResponseDto<>(new ArrayList<>());
} }
return new ResponseDto<>(advertisingSpaceBiz.distributionDateStatics(adId, day)); return new ResponseDto<>(advertisingSpaceBiz.get4Wechat(sceneId, adviserId, channelId, adPositionDetail));
} }
/** /**
* 获取书刊配置的广告位信息 * 获取社群书配置的广告位信息
*/ */
@Override @Override
@RequestMapping(value = "get4Wechat", method = RequestMethod.GET) @RequestMapping(value = "getBookGroupAd4Wechat", method = RequestMethod.GET)
public ResponseDto<?> get4Wechat(@CookieValue("userInfo") String userInfo) public ResponseDto<?> getBookGroupAd4Wechat(@CookieValue("userInfo") String userInfo, @RequestParam(value = "adPositionDetail", required = false) String adPositionDetail)
throws PermissionException, BizException, JsonParseException { throws PermissionException, BizException, JsonParseException {
Long sceneId = Cookie.getId(userInfo, Cookie._SCENE_ID); if (StringUtil.isEmpty(adPositionDetail)) {
Long adviserId = Cookie.getId(userInfo, Cookie._ADVISER_ID); throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!");
Long channelId = Cookie.getId(userInfo, Cookie._CHANNEL_ID); }
if (null == sceneId || null == adviserId || null == channelId) { Long bookGroupId = Cookie.getId(userInfo, Cookie.BOOK_GROUP_ID);
if (null == bookGroupId) {
return new ResponseDto<>(new AdvertisingSpaceDTO()); return new ResponseDto<>(new AdvertisingSpaceDTO());
} }
return new ResponseDto<>(advertisingSpaceBiz.get4Wechat(sceneId, adviserId, channelId)); return new ResponseDto<>(advertisingSpaceBiz.getBookGroupAd4Wechat(bookGroupId, adPositionDetail));
} }
/** /**
...@@ -331,14 +357,20 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade { ...@@ -331,14 +357,20 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade {
@RequestMapping(value = "addClickTrack", method = RequestMethod.POST) @RequestMapping(value = "addClickTrack", method = RequestMethod.POST)
public ResponseDto<?> addClickTrack(@CookieValue("userInfo") String userInfo, @RequestBody AdvertisingClickRecord advertisingClickRecord) public ResponseDto<?> addClickTrack(@CookieValue("userInfo") String userInfo, @RequestBody AdvertisingClickRecord advertisingClickRecord)
throws PermissionException, BizException, JsonParseException { throws PermissionException, BizException, JsonParseException {
if (null == advertisingClickRecord || null == advertisingClickRecord.getAdId() || null == advertisingClickRecord.getBookId()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!");
}
Long sceneId = Cookie.getId(userInfo, Cookie._SCENE_ID); Long sceneId = Cookie.getId(userInfo, Cookie._SCENE_ID);
Long adviserId = Cookie.getId(userInfo, Cookie._ADVISER_ID); Long adviserId = Cookie.getId(userInfo, Cookie._ADVISER_ID);
Long channelId = Cookie.getId(userInfo, Cookie._CHANNEL_ID); Long channelId = Cookie.getId(userInfo, Cookie._CHANNEL_ID);
Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID); Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID);
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID); Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
Long bookGroupId = Cookie.getId(userInfo, Cookie.BOOK_GROUP_ID);
if (null == advertisingClickRecord || null == advertisingClickRecord.getAdId() || null == wechatUserId) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!");
}
if ((null == advertisingClickRecord.getBookId() && !"WECHAT_GROUP".equals(advertisingClickRecord.getFromType()))
|| (null == bookGroupId && "WECHAT_GROUP".equals(advertisingClickRecord.getFromType()))) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!");
}
advertisingClickRecord.setBookGroupId(bookGroupId);
advertisingClickRecord.setSceneId(sceneId); advertisingClickRecord.setSceneId(sceneId);
advertisingClickRecord.setAdviserId(adviserId); advertisingClickRecord.setAdviserId(adviserId);
advertisingClickRecord.setChannelId(channelId); advertisingClickRecord.setChannelId(channelId);
...@@ -347,4 +379,293 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade { ...@@ -347,4 +379,293 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade {
advertisingSpaceBiz.addClickTrack(advertisingClickRecord); advertisingSpaceBiz.addClickTrack(advertisingClickRecord);
return new ResponseDto<>(); return new ResponseDto<>();
} }
/**
* 添加广告主
*/
@Override
@RequestMapping(value = "createMaster", method = RequestMethod.POST)
public ResponseDto<?> createMaster(@RequestHeader("token") String token, @RequestBody AdvertisingMaster advertisingMaster)
throws PermissionException, BizException, JsonParseException {
if (null == advertisingMaster) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!");
}
SessionUtil.getToken4Redis(token);
advertisingSpaceBiz.createMaster(advertisingMaster);
return new ResponseDto<>();
}
/**
* 修改广告主
*/
@Override
@RequestMapping(value = "updateMaster", method = RequestMethod.POST)
public ResponseDto<?> updateMaster(@RequestHeader("token") String token, @RequestBody AdvertisingMaster advertisingMaster)
throws PermissionException, BizException, JsonParseException {
if (null == advertisingMaster) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!");
}
SessionUtil.getToken4Redis(token);
advertisingSpaceBiz.updateMaster(advertisingMaster);
return new ResponseDto<>();
}
/**
* 获取广告主列表
*/
@Override
@RequestMapping(value = "getMasterList", method = RequestMethod.GET)
public ResponseDto<?> getMasterList(@RequestHeader("token") String token, @RequestParam(value = "masterName", required = false) String masterName,
@RequestParam(value = "currentPage", required = false) Integer currentPage, @RequestParam(value = "numPerPage", required = false) Integer numPerPage)
throws PermissionException, BizException, JsonParseException {
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
throw BookBizException.PAGE_PARAM_DELETION;
}
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(advertisingSpaceBiz.getMasterList(new PageParam(currentPage, numPerPage), masterName));
}
/**
* 获取所有广告主
*/
@Override
@RequestMapping(value = "getAllMaster", method = RequestMethod.GET)
public ResponseDto<?> getAllMaster(@RequestHeader("token") String token) throws PermissionException, BizException, JsonParseException {
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(advertisingSpaceBiz.getAllMaster());
}
/**
* 获取广告主信息
*/
@Override
@RequestMapping(value = "getMasterInfo", method = RequestMethod.GET)
public ResponseDto<?> getMasterInfo(@RequestHeader("token") String token, @RequestParam(value = "masterId", required = false) Long masterId)
throws PermissionException, BizException, JsonParseException {
if (null == masterId) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!");
}
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(advertisingSpaceBiz.getMasterInfo(masterId));
}
/**
* 获取概览数据
*/
@Override
@RequestMapping(value = "overviewStatis", method = RequestMethod.GET)
public ResponseDto<?> overviewStatis(@RequestHeader("token") String token) throws PermissionException, BizException, JsonParseException {
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(advertisingSpaceBiz.overviewStatis());
}
/**
* 获取流量趋势
*/
@Override
@RequestMapping(value = "getFlowStatisTrend", method = RequestMethod.GET)
public ResponseDto<?> getFlowStatisTrend(@RequestHeader("token") String token, @RequestParam(value = "day", required = false) Integer day,
@RequestParam(value = "startDate", required = false) String startDate, @RequestParam(value = "endDate", required = false) String endDate)
throws PermissionException, BizException, JsonParseException {
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(advertisingSpaceBiz.getFlowStatisTrend(day, startDate, endDate));
}
/**
* 获取收益趋势
*/
@Override
@RequestMapping(value = "getIncomeStatisTrend", method = RequestMethod.GET)
public ResponseDto<?> getIncomeStatisTrend(@RequestHeader("token") String token, @RequestParam(value = "day", required = false) Integer day,
@RequestParam(value = "startDate", required = false) String startDate, @RequestParam(value = "endDate", required = false) String endDate)
throws PermissionException, BizException, JsonParseException {
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(advertisingSpaceBiz.getIncomeStatisTrend(day, startDate, endDate));
}
/**
* 获取广告位投放书刊列表
*/
@Override
@RequestMapping(value = "advertisingBookList", method = RequestMethod.GET)
public ResponseDto<?> advertisingBookList(@RequestHeader("token") String token, @RequestParam(value = "name", required = false) String name,
@RequestParam(value = "currentPage", required = false) Integer currentPage, @RequestParam(value = "numPerPage", required = false) Integer numPerPage)
throws PermissionException, BizException, JsonParseException {
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
throw BookBizException.PAGE_PARAM_DELETION;
}
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(advertisingSpaceBiz.advertisingBookList(name, new PageParam(currentPage, numPerPage)));
}
/**
* 获取广告位投放微信群列表
*/
@Override
@RequestMapping(value = "advertisingWechatGroupList", method = RequestMethod.GET)
public ResponseDto<?> advertisingWechatGroupList(@RequestHeader("token") String token, @RequestParam(value = "name", required = false) String name,
@RequestParam(value = "currentPage", required = false) Integer currentPage, @RequestParam(value = "numPerPage", required = false) Integer numPerPage)
throws PermissionException, BizException, JsonParseException {
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
throw BookBizException.PAGE_PARAM_DELETION;
}
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(advertisingSpaceBiz.advertisingWechatGroupList(name, new PageParam(currentPage, numPerPage)));
}
/**
* 获取广告位投放微信群曝光量前几位
*/
@Override
@RequestMapping(value = "advertisingWechatGroupRankTop", method = RequestMethod.GET)
public ResponseDto<?> advertisingWechatGroupRankTop(@RequestHeader("token") String token) throws PermissionException, BizException, JsonParseException {
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(advertisingSpaceBiz.advertisingWechatGroupRankTop());
}
/**
* 书刊广告位明细
*/
@Override
@RequestMapping(value = "advertisingDetail4Book", method = RequestMethod.GET)
public ResponseDto<?> advertisingDetail4Book(@RequestHeader("token") String token, @RequestParam(value = "bookId", required = false) Long bookId,
@RequestParam(value = "channelId", required = false) Long channelId, @RequestParam(value = "adviserId", required = false) Long adviserId,
@RequestParam(value = "statisMonth", required = false) String statisMonth, @RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage) throws PermissionException, BizException, JsonParseException {
if (null == bookId || null == adviserId || null == channelId || null == statisMonth) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!");
}
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
throw BookBizException.PAGE_PARAM_DELETION;
}
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(advertisingSpaceBiz.advertisingDetail4Book(bookId, channelId, adviserId, statisMonth, new PageParam(currentPage, numPerPage)));
}
/**
* 导出书刊广告位明细
*/
@Override
@RequestMapping(value = "exportAdvertisingDetail4Book", method = RequestMethod.GET)
public ResponseDto<?> exportAdvertisingDetail4Book(@RequestHeader("token") String token, @RequestParam(value = "bookId", required = false) Long bookId,
@RequestParam(value = "channelId", required = false) Long channelId, @RequestParam(value = "adviserId", required = false) Long adviserId,
@RequestParam(value = "statisMonth", required = false) String statisMonth) throws PermissionException, BizException, JsonParseException {
if (null == bookId || null == adviserId || null == channelId || null == statisMonth) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!");
}
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(advertisingSpaceBiz.exportAdvertisingDetail4Book(bookId, channelId, adviserId, statisMonth));
}
/**
* 微信群广告位明细
*/
@Override
@RequestMapping(value = "advertisingDetail4WechatGroup", method = RequestMethod.GET)
public ResponseDto<?> advertisingDetail4WechatGroup(@RequestHeader("token") String token, @RequestParam(value = "qrcodeId", required = false) Long qrcodeId,
@RequestParam(value = "statisMonth", required = false) String statisMonth, @RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage) throws PermissionException, BizException, JsonParseException {
if (null == qrcodeId || null == statisMonth) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!");
}
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
throw BookBizException.PAGE_PARAM_DELETION;
}
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(advertisingSpaceBiz.advertisingDetail4WechatGroup(qrcodeId, statisMonth, new PageParam(currentPage, numPerPage)));
}
/**
* 导出微信群广告位明细
*/
@Override
@RequestMapping(value = "exportAdvertisingDetail4WechatGroup", method = RequestMethod.GET)
public ResponseDto<?> exportAdvertisingDetail4WechatGroup(@RequestHeader("token") String token, @RequestParam(value = "qrcodeId", required = false) Long qrcodeId,
@RequestParam(value = "statisMonth", required = false) String statisMonth) throws PermissionException, BizException, JsonParseException {
if (null == qrcodeId || null == statisMonth) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!");
}
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(advertisingSpaceBiz.exportAdvertisingDetail4WechatGroup(qrcodeId, statisMonth));
}
/**
* 微信群广告位点击读者列表
*/
@Override
@RequestMapping(value = "clickUserList4AdvertisingWechatGroup", method = RequestMethod.GET)
public ResponseDto<?> clickUserList4AdvertisingWechatGroup(@RequestHeader("token") String token, @RequestParam(value = "qrcodeId", required = false) Long qrcodeId,
@RequestParam(value = "adId", required = false) Long adId, @RequestParam(value = "statisMonth", required = false) String statisMonth,
@RequestParam(value = "currentPage", required = false) Integer currentPage, @RequestParam(value = "numPerPage", required = false) Integer numPerPage)
throws PermissionException, BizException, JsonParseException {
if (null == qrcodeId || null == adId) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!");
}
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
throw BookBizException.PAGE_PARAM_DELETION;
}
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(advertisingSpaceBiz.clickUserList4AdvertisingWechatGroup(qrcodeId, adId, statisMonth, new PageParam(currentPage, numPerPage)));
}
/**
* 导出微信群广告位点击读者列表
*/
@Override
@RequestMapping(value = "exportClickUserList4AdvertisingWechatGroup", method = RequestMethod.GET)
public ResponseDto<?> exportClickUserList4AdvertisingWechatGroup(@RequestHeader("token") String token, @RequestParam(value = "qrcodeId", required = false) Long qrcodeId,
@RequestParam(value = "adId", required = false) Long adId, @RequestParam(value = "statisMonth", required = false) String statisMonth)
throws PermissionException, BizException, JsonParseException {
if (null == qrcodeId || null == adId) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!");
}
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(advertisingSpaceBiz.exportClickUserList4AdvertisingWechatGroup(qrcodeId, adId, statisMonth));
}
/**
* 广告主广告位明细
*/
@Override
@RequestMapping(value = "advertisingDetail4Master", method = RequestMethod.GET)
public ResponseDto<?> advertisingDetail4Master(@RequestHeader("token") String token, @RequestParam(value = "masterId", required = false) Long masterId,
@RequestParam(value = "statisMonth", required = false) String statisMonth, @RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage) throws PermissionException, BizException, JsonParseException {
if (null == masterId || null == statisMonth) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!");
}
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
throw BookBizException.PAGE_PARAM_DELETION;
}
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(advertisingSpaceBiz.advertisingDetail4Master(masterId, statisMonth, new PageParam(currentPage, numPerPage)));
}
/**
* 导出广告主广告位明细
*/
@Override
@RequestMapping(value = "exportAdvertisingDetail4Master", method = RequestMethod.GET)
public ResponseDto<?> exportAdvertisingDetail4Master(@RequestHeader("token") String token, @RequestParam(value = "masterId", required = false) Long masterId,
@RequestParam(value = "statisMonth", required = false) String statisMonth) throws PermissionException, BizException, JsonParseException {
if (null == masterId || null == statisMonth) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!");
}
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(advertisingSpaceBiz.exportAdvertisingDetail4Master(masterId, statisMonth));
}
/**
* 获取微信群信息
*/
@Override
@RequestMapping(value = "getGroupQrcodeInfo", method = RequestMethod.GET)
public ResponseDto<?> getGroupQrcodeInfo(@RequestHeader("token") String token, @RequestParam(value = "qrcodeId", required = false) Long qrcodeId)
throws PermissionException, BizException, JsonParseException {
if (null == qrcodeId) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!");
}
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(advertisingSpaceBiz.getGroupQrcodeInfo(qrcodeId));
}
} }
package com.pcloud.book.advertising.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.pcloud.book.advertising.biz.AdvertisingSpaceBiz;
import com.pcloud.book.advertising.service.AdvertisingSpaceService;
import com.pcloud.common.exceptions.BizException;
/**
* Description 广告位内部接口实现类
* Created by PENG on 2019/5/6.
*/
@RestController("advertisingSpaceService")
@RequestMapping("advertisingSpaceService")
public class AdvertisingSpaceServiceImpl implements AdvertisingSpaceService {
@Autowired
private AdvertisingSpaceBiz advertisingSpaceBiz;
/**
* 每日凌晨计算昨日广告位收益
*/
@Override
@RequestMapping(value = "calculateAdvertisingIncomeYesterday", method = RequestMethod.GET)
public void calculateAdvertisingIncomeYesterday() throws BizException {
advertisingSpaceBiz.calculateAdvertisingIncomeYesterday();
}
}
...@@ -1265,6 +1265,9 @@ public class BookBizImpl implements BookBiz { ...@@ -1265,6 +1265,9 @@ public class BookBizImpl implements BookBiz {
bookSet.setTemplateName(pageBean.getRecordList()); bookSet.setTemplateName(pageBean.getRecordList());
// 设置运营平台名称 // 设置运营平台名称
bookSet.setChannelInfoList(pageBean.getRecordList()); bookSet.setChannelInfoList(pageBean.getRecordList());
// 设置出版社名称
bookSet.setAgentId4BookDto(pageBean.getRecordList());
bookSet.setAgentName4BookDto(pageBean.getRecordList());
// 设置图书收益 // 设置图书收益
bookSet.setBookIncome(pageBean.getRecordList()); bookSet.setBookIncome(pageBean.getRecordList());
} else { } else {
......
...@@ -288,6 +288,22 @@ public class BookSet { ...@@ -288,6 +288,22 @@ public class BookSet {
} }
/** /**
* 批量填充出版ID
*/
public void setAgentId4BookDto(List<Object> objects) {
LOGGER.info("【书刊基础】批量填充出版ID,<START>");
for (Object object : objects) {
BookDto bookDto = (BookDto) object;
Long adviserId = bookDto.getAdviserId();
if (null != adviserId) {
Long agentId = adviserConsr.getAgentIdByAdviser(adviserId);
bookDto.setAgentId(agentId);
}
}
LOGGER.info("【书刊基础】批量填充出版ID,<END>");
}
/**
* 批量填充出版名称 * 批量填充出版名称
*/ */
public void setAgentName4BookDto(List<Object> objects) { public void setAgentName4BookDto(List<Object> objects) {
......
package com.pcloud.book.consumer.reader; package com.pcloud.book.consumer.reader;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.alibaba.druid.support.json.JSONUtils; import com.alibaba.druid.support.json.JSONUtils;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
...@@ -8,13 +16,6 @@ import com.pcloud.common.utils.ResponseHandleUtil; ...@@ -8,13 +16,6 @@ import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.readercenter.wechat.dto.WechatUserRobotDto; import com.pcloud.readercenter.wechat.dto.WechatUserRobotDto;
import com.pcloud.readercenter.wechat.entity.WechatUser; import com.pcloud.readercenter.wechat.entity.WechatUser;
import com.pcloud.readercenter.wechat.service.WechatUserService; import com.pcloud.readercenter.wechat.service.WechatUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.stream.Collectors;
/** /**
* @author lily * @author lily
...@@ -27,8 +28,6 @@ public class ReaderConsr { ...@@ -27,8 +28,6 @@ public class ReaderConsr {
*/ */
private static final Logger LOGGER = LoggerFactory.getLogger(ReaderConsr.class); private static final Logger LOGGER = LoggerFactory.getLogger(ReaderConsr.class);
@Autowired @Autowired
private WechatUserService wechatUserService; private WechatUserService wechatUserService;
...@@ -37,14 +36,24 @@ public class ReaderConsr { ...@@ -37,14 +36,24 @@ public class ReaderConsr {
return null; return null;
} }
try { try {
return ResponseHandleUtil.parseResponse(wechatUserService.getWechatUser(wechatUserId), WechatUser.class); return ResponseHandleUtil.parseResponse(wechatUserService.getWechatUser(wechatUserId), WechatUser.class);
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("获取微信用户信息失败[wechatUserService.getWechatUser]:" + e.getMessage(), e); LOGGER.error("获取微信用户信息失败[wechatUserService.getWechatUser]:" + e.getMessage(), e);
} }
return null; return null;
} }
public Map<Long, WechatUser> getUserList(List<Long> wechatUserIds) throws BizException {
if (ListUtils.isEmpty(wechatUserIds)) {
return new HashMap<>();
}
try {
return ResponseHandleUtil.parseMap(wechatUserService.getUserList(wechatUserIds), Long.class, WechatUser.class);
} catch (Exception e) {
LOGGER.error("获取微信用户信息失败[wechatUserService.getUserList]:" + e.getMessage(), e);
}
return null;
}
@ParamLog(value = "随机获取n个用户", isAfterReturn = false) @ParamLog(value = "随机获取n个用户", isAfterReturn = false)
public List<WechatUserRobotDto> selectRobotsRandom(Integer number) throws BizException { public List<WechatUserRobotDto> selectRobotsRandom(Integer number) throws BizException {
...@@ -52,7 +61,7 @@ public class ReaderConsr { ...@@ -52,7 +61,7 @@ public class ReaderConsr {
return null; return null;
} }
try { try {
return ResponseHandleUtil.parseListResponse(wechatUserService.selectRobotsRandom(number), WechatUserRobotDto.class); return ResponseHandleUtil.parseListResponse(wechatUserService.selectRobotsRandom(number), WechatUserRobotDto.class);
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("随机获取n个用户失败[wechatUserService.getWechatUserRand]:" + e.getMessage(), e); LOGGER.error("随机获取n个用户失败[wechatUserService.getWechatUserRand]:" + e.getMessage(), e);
} }
......
...@@ -73,4 +73,11 @@ public interface GroupQrcodeBiz { ...@@ -73,4 +73,11 @@ public interface GroupQrcodeBiz {
* @Date:2019/5/6 16:12 * @Date:2019/5/6 16:12
*/ */
GroupQrcodeBaseInfoVO getBaseById(Long groupQrcodeId); GroupQrcodeBaseInfoVO getBaseById(Long groupQrcodeId);
/**
* @Author:lili
* @Desr:更新用户数
* @Date:2019/5/28 11:47
*/
void updateUserNumber(String weixinGroupId);
} }
...@@ -220,6 +220,18 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz { ...@@ -220,6 +220,18 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
return groupQrcodeDao.getBaseById(groupQrcodeId); return groupQrcodeDao.getBaseById(groupQrcodeId);
} }
@Override
public void updateUserNumber(String weixinGroupId) {
String robotIdByGroupId = wechatGroupConsr.getRobotIdByGroupId(weixinGroupId);
if(robotIdByGroupId != null){
Integer peopleCounts = WxGroupSDK.getPeopleCounts(weixinGroupId, robotIdByGroupId);
if (peopleCounts != null) {
//更新用户数
groupQrcodeDao.updateUserNumber(weixinGroupId, peopleCounts);
}
}
}
/** /**
* 重新分配一个群 * 重新分配一个群
*/ */
......
...@@ -82,6 +82,11 @@ public class AdGroupQrcodeDTO implements Serializable { ...@@ -82,6 +82,11 @@ public class AdGroupQrcodeDTO implements Serializable {
private Long clickNum; private Long clickNum;
/** /**
* 点击读者量
*/
private Long clickUserNum;
/**
* 广告位数量 * 广告位数量
*/ */
private Long advertisingSpaceNum; private Long advertisingSpaceNum;
...@@ -259,6 +264,14 @@ public class AdGroupQrcodeDTO implements Serializable { ...@@ -259,6 +264,14 @@ public class AdGroupQrcodeDTO implements Serializable {
this.distributionTime = distributionTime; this.distributionTime = distributionTime;
} }
public Long getClickUserNum() {
return clickUserNum;
}
public void setClickUserNum(Long clickUserNum) {
this.clickUserNum = clickUserNum;
}
@Override @Override
public String toString() { public String toString() {
return "AdGroupQrcodeDTO{" + return "AdGroupQrcodeDTO{" +
...@@ -276,6 +289,7 @@ public class AdGroupQrcodeDTO implements Serializable { ...@@ -276,6 +289,7 @@ public class AdGroupQrcodeDTO implements Serializable {
", agentName='" + agentName + '\'' + ", agentName='" + agentName + '\'' +
", exposureNum=" + exposureNum + ", exposureNum=" + exposureNum +
", clickNum=" + clickNum + ", clickNum=" + clickNum +
", clickUserNum=" + clickUserNum +
", advertisingSpaceNum=" + advertisingSpaceNum + ", advertisingSpaceNum=" + advertisingSpaceNum +
", clickRate=" + clickRate + ", clickRate=" + clickRate +
", totalIncome=" + totalIncome + ", totalIncome=" + totalIncome +
......
...@@ -58,10 +58,18 @@ public class GroupQrcodeFacadeImpl implements GroupQrcodeFacade { ...@@ -58,10 +58,18 @@ public class GroupQrcodeFacadeImpl implements GroupQrcodeFacade {
GroupQrcodeBaseInfoVO groupQrcodeBaseInfoVO = groupQrcodeBiz.getBaseById(groupQrcodeId); GroupQrcodeBaseInfoVO groupQrcodeBaseInfoVO = groupQrcodeBiz.getBaseById(groupQrcodeId);
return new ResponseDto<>(groupQrcodeBaseInfoVO == null ? new GroupQrcodeBaseInfoVO() : groupQrcodeBaseInfoVO); return new ResponseDto<>(groupQrcodeBaseInfoVO == null ? new GroupQrcodeBaseInfoVO() : groupQrcodeBaseInfoVO);
} }
@GetMapping("addUser") @GetMapping("addUser")
ResponseDto<?> addUser(@RequestParam("weixinGroupId") String weixinGroupId, @RequestParam("userNumber") Integer userNumber) ResponseDto<?> addUser(@RequestParam("weixinGroupId") String weixinGroupId, @RequestParam("userNumber") Integer userNumber)
throws BizException{ throws BizException{
groupQrcodeBiz.addOneUser(weixinGroupId, userNumber, null); groupQrcodeBiz.addOneUser(weixinGroupId, userNumber, null);
return new ResponseDto<>(); return new ResponseDto<>();
} }
@GetMapping("updateUserNumber")
ResponseDto<?> updateUserNumber(@RequestParam("weixinGroupId") String weixinGroupId)
throws BizException{
groupQrcodeBiz.updateUserNumber(weixinGroupId);
return new ResponseDto<>();
}
} }
...@@ -2,24 +2,26 @@ ...@@ -2,24 +2,26 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.advertising.dao.impl.AdvertisingClickRecordDaoImpl"> <mapper namespace="com.pcloud.book.advertising.dao.impl.AdvertisingClickRecordDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.advertising.entity.AdvertisingClickRecord"> <resultMap id="BaseResultMap" type="com.pcloud.book.advertising.entity.AdvertisingClickRecord">
<id column="id" property="id" jdbcType="INTEGER"/> <id column="id" property="id" jdbcType="BIGINT"/>
<result column="ad_id" property="adId" jdbcType="INTEGER"/> <result column="ad_id" property="adId" jdbcType="BIGINT"/>
<result column="book_id" property="bookId" jdbcType="INTEGER"/> <result column="book_id" property="bookId" jdbcType="BIGINT"/>
<result column="scene_id" property="sceneId" jdbcType="INTEGER"/> <result column="is_book_group" property="isBookGroup" jdbcType="BIT"/>
<result column="adviser_id" property="adviserId" jdbcType="INTEGER"/> <result column="scene_id" property="sceneId" jdbcType="BIGINT"/>
<result column="agent_id" property="agentId" jdbcType="INTEGER"/> <result column="adviser_id" property="adviserId" jdbcType="BIGINT"/>
<result column="channel_id" property="channelId" jdbcType="INTEGER"/> <result column="agent_id" property="agentId" jdbcType="BIGINT"/>
<result column="official_account_id" property="officialAccountId" jdbcType="INTEGER"/> <result column="channel_id" property="channelId" jdbcType="BIGINT"/>
<result column="official_account_id" property="officialAccountId" jdbcType="BIGINT"/>
<result column="from_type" property="fromType" jdbcType="VARCHAR"/> <result column="from_type" property="fromType" jdbcType="VARCHAR"/>
<result column="from_id" property="fromId" jdbcType="INTEGER"/> <result column="from_id" property="fromId" jdbcType="BIGINT"/>
<result column="wechat_user_id" property="wechatUserId" jdbcType="INTEGER"/> <result column="wechat_user_id" property="wechatUserId" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="create_day" property="createDay" jdbcType="DATE"/> <result column="create_day" property="createDay" jdbcType="DATE"/>
<result column="create_month" property="createMonth" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, ad_id, book_id, scene_id, adviser_id, agent_id, channel_id, official_account_id, from_type, id, ad_id, book_id, is_book_group, scene_id, adviser_id, agent_id, channel_id, official_account_id, from_type,
from_id, wechat_user_id, create_time, create_day from_id, wechat_user_id, create_time, create_day, create_month
</sql> </sql>
<select id="getById" resultMap="BaseResultMap" parameterType="Long"> <select id="getById" resultMap="BaseResultMap" parameterType="Long">
...@@ -41,23 +43,109 @@ ...@@ -41,23 +43,109 @@
AND adviser_id = #{adviserId} AND adviser_id = #{adviserId}
AND channel_id = #{channelId} AND channel_id = #{channelId}
</if> </if>
<if test="fromId != null"> <if test="statisMonth != null">
AND from_id = #{fromId} and create_month = #{statisMonth}
AND from_type = #{fromType}
</if> </if>
</select> </select>
<select id="getClickNumByMasterId" parameterType="map" resultType="Long">
SELECT
count(1)
FROM
advertising_click_record r
INNER JOIN advertising_space s ON r.ad_id = s.id
WHERE
s.master_id = #{masterId}
</select>
<select id="getClickNumByBookId" parameterType="map" resultType="Long">
SELECT
count(1)
FROM
advertising_click_record
WHERE
book_id = #{bookId}
AND adviser_id = #{adviserId}
AND channel_id = #{channelId}
AND from_type != 'WECHAT_GROUP'
</select>
<select id="getClickNumByGroupQrcodeId" parameterType="map" resultType="Long">
SELECT
count(1)
FROM
advertising_click_record
WHERE
from_id = #{qrcodeId}
AND from_type = 'WECHAT_GROUP'
<if test="adId != null">
AND ad_id = #{adId}
</if>
<if test="statisMonth != null">
AND create_month = #{statisMonth}
</if>
</select>
<select id="getClickUserNumByGroupQrcodeId" parameterType="map" resultType="Long">
SELECT
count(DISTINCT wechat_user_id)
FROM
advertising_click_record
WHERE
from_id = #{qrcodeId}
AND from_type = 'WECHAT_GROUP'
<if test="adId != null">
AND ad_id = #{adId}
</if>
<if test="statisMonth != null">
AND create_month = #{statisMonth}
</if>
AND wechat_user_id IS NOT NULL
</select>
<select id="getTotalClickNum" resultType="Long">
SELECT
count(1)
FROM
advertising_click_record
</select>
<delete id="deleteById" parameterType="Long"> <delete id="deleteById" parameterType="Long">
delete from advertising_click_record delete from advertising_click_record
where id = #{id} where id = #{id}
</delete> </delete>
<select id="clickUserList4AdvertisingWechatGroup" parameterType="map" resultType="com.pcloud.book.advertising.dto.WechatGroupClickUserDTO">
SELECT
ad_id adId,
official_account_id officialAccountId,
from_type fromType,
from_id fromId,
wechat_user_id wechatUserId,
max(create_time) createTime
FROM
advertising_click_record
WHERE
from_id = #{qrcodeId}
AND from_type = 'WECHAT_GROUP'
AND ad_id = #{adId}
<if test="statisMonth != null">
AND create_month = #{statisMonth}
</if>
AND wechat_user_id IS NOT NULL
GROUP BY
wechat_user_id
ORDER BY
createTime DESC
</select>
<insert id="insert" parameterType="com.pcloud.book.advertising.entity.AdvertisingClickRecord" <insert id="insert" parameterType="com.pcloud.book.advertising.entity.AdvertisingClickRecord"
useGeneratedKeys="true" keyProperty="id"> useGeneratedKeys="true" keyProperty="id">
insert into advertising_click_record insert into advertising_click_record
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
ad_id, ad_id,
book_id, book_id,
is_book_group,
scene_id, scene_id,
adviser_id, adviser_id,
agent_id, agent_id,
...@@ -68,20 +156,23 @@ ...@@ -68,20 +156,23 @@
wechat_user_id, wechat_user_id,
create_time, create_time,
create_day, create_day,
create_month,
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
#{adId,jdbcType=INTEGER}, #{adId,jdbcType=BIGINT},
#{bookId,jdbcType=INTEGER}, #{bookId,jdbcType=BIGINT},
#{sceneId,jdbcType=INTEGER}, #{isBookGroup,jdbcType=BIT},
#{adviserId,jdbcType=INTEGER}, #{sceneId,jdbcType=BIGINT},
#{agentId,jdbcType=INTEGER}, #{adviserId,jdbcType=BIGINT},
#{channelId,jdbcType=INTEGER}, #{agentId,jdbcType=BIGINT},
#{officialAccountId,jdbcType=INTEGER}, #{channelId,jdbcType=BIGINT},
#{officialAccountId,jdbcType=BIGINT},
#{fromType,jdbcType=VARCHAR}, #{fromType,jdbcType=VARCHAR},
#{fromId,jdbcType=INTEGER}, #{fromId,jdbcType=BIGINT},
#{wechatUserId,jdbcType=INTEGER}, #{wechatUserId,jdbcType=BIGINT},
NOW(), NOW(),
NOW(), NOW(),
DATE_FORMAT(NOW(), '%Y-%m'),
</trim> </trim>
</insert> </insert>
...@@ -89,36 +180,39 @@ ...@@ -89,36 +180,39 @@
update advertising_click_record update advertising_click_record
<set> <set>
<if test="adId != null"> <if test="adId != null">
ad_id = #{adId,jdbcType=INTEGER}, ad_id = #{adId,jdbcType=BIGINT},
</if> </if>
<if test="bookId != null"> <if test="bookId != null">
book_id = #{bookId,jdbcType=INTEGER}, book_id = #{bookId,jdbcType=BIGINT},
</if>
<if test="isBookGroup != null">
is_book_group = #{isBookGroup,jdbcType=BIT},
</if> </if>
<if test="sceneId != null"> <if test="sceneId != null">
scene_id = #{sceneId,jdbcType=INTEGER}, scene_id = #{sceneId,jdbcType=BIGINT},
</if> </if>
<if test="adviserId != null"> <if test="adviserId != null">
adviser_id = #{adviserId,jdbcType=INTEGER}, adviser_id = #{adviserId,jdbcType=BIGINT},
</if> </if>
<if test="agentId != null"> <if test="agentId != null">
agent_id = #{agentId,jdbcType=INTEGER}, agent_id = #{agentId,jdbcType=BIGINT},
</if> </if>
<if test="channelId != null"> <if test="channelId != null">
channel_id = #{channelId,jdbcType=INTEGER}, channel_id = #{channelId,jdbcType=BIGINT},
</if> </if>
<if test="officialAccountId != null"> <if test="officialAccountId != null">
official_account_id = #{officialAccountId,jdbcType=INTEGER}, official_account_id = #{officialAccountId,jdbcType=BIGINT},
</if> </if>
<if test="fromType != null"> <if test="fromType != null">
from_type = #{fromType,jdbcType=VARCHAR}, from_type = #{fromType,jdbcType=VARCHAR},
</if> </if>
<if test="fromId != null"> <if test="fromId != null">
from_id = #{fromId,jdbcType=INTEGER}, from_id = #{fromId,jdbcType=BIGINT},
</if> </if>
<if test="wechatUserId != null"> <if test="wechatUserId != null">
wechat_user_id = #{wechatUserId,jdbcType=INTEGER}, wechat_user_id = #{wechatUserId,jdbcType=BIGINT},
</if> </if>
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=BIGINT}
</update> </update>
</mapper> </mapper>
\ No newline at end of file
...@@ -2,17 +2,20 @@ ...@@ -2,17 +2,20 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.advertising.dao.impl.AdvertisingDistributionBookDaoImpl"> <mapper namespace="com.pcloud.book.advertising.dao.impl.AdvertisingDistributionBookDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.advertising.entity.AdvertisingDistributionBook"> <resultMap id="BaseResultMap" type="com.pcloud.book.advertising.entity.AdvertisingDistributionBook">
<id column="id" property="id" jdbcType="INTEGER"/> <id column="id" property="id" jdbcType="BIGINT"/>
<result column="ad_id" property="adId" jdbcType="INTEGER"/> <result column="ad_id" property="adId" jdbcType="BIGINT"/>
<result column="book_id" property="bookId" jdbcType="INTEGER"/> <result column="book_id" property="bookId" jdbcType="BIGINT"/>
<result column="adviser_id" property="adviserId" jdbcType="INTEGER"/> <result column="adviser_id" property="adviserId" jdbcType="BIGINT"/>
<result column="agent_id" property="agentId" jdbcType="INTEGER"/> <result column="agent_id" property="agentId" jdbcType="BIGINT"/>
<result column="channel_id" property="channelId" jdbcType="INTEGER"/> <result column="channel_id" property="channelId" jdbcType="BIGINT"/>
<result column="is_book_group" property="isBookGroup" jdbcType="BIT"/>
<result column="classify_id" property="classifyId" jdbcType="BIGINT"/>
<result column="qrcode_id" property="qrcodeId" jdbcType="BIGINT"/>
<result column="distribution_time" property="distributionTime" jdbcType="TIMESTAMP"/> <result column="distribution_time" property="distributionTime" jdbcType="TIMESTAMP"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, ad_id, book_id, adviser_id, agent_id, channel_id, distribution_time id, ad_id, book_id, adviser_id, agent_id, channel_id, is_book_group, classify_id, qrcode_id, distribution_time
</sql> </sql>
<select id="getById" resultMap="BaseResultMap" parameterType="Long"> <select id="getById" resultMap="BaseResultMap" parameterType="Long">
...@@ -29,22 +32,139 @@ ...@@ -29,22 +32,139 @@
where ad_id = #{adId} where ad_id = #{adId}
</select> </select>
<select id="checkBookIdExist" parameterType="list" resultType="Long"> <select id="countByAdId" resultType="Integer" parameterType="map">
select select
b.book_id count(1)
from advertising_distribution_book
where ad_id = #{adId}
</select>
<select id="getDistributionBookNum" resultType="Long">
SELECT
count(
DISTINCT (
CONCAT(a.BOOK_ID, '-', a.CHANNEL_ID)
)
)
FROM
BOOK_ADVISER a
INNER JOIN BOOK b ON a.BOOK_ID = b.BOOK_ID
AND a.IS_DELETE = 0
AND b.IS_DELETE = 0
INNER JOIN advertising_distribution_book db ON db.book_id = a.BOOK_ID
AND db.channel_id = a.CHANNEL_ID
AND db.adviser_id = a.ADVISER_ID
AND db.qrcode_id IS NULL
LEFT JOIN advertising_agent_permission ap ON ap.agent_id = db.agent_id
LEFT JOIN advertising_adviser_permission adp ON adp.adviser_id = a.ADVISER_ID
AND adp.channel_id = a.CHANNEL_ID
AND adp.book_id = a.BOOK_ID
</select>
<select id="getDistributionWechatGroupNum" resultType="Long">
select
count(distinct qrcode_id)
from
advertising_distribution_book
where
qrcode_id is not null
</select>
<select id="distributionWechatGroupList" parameterType="map" resultType="AdGroupQrcodeDTO">
SELECT
c.book_id bookId,
c.channel_id channelId,
c.create_user adviserId,
q.id groupQrcodeId,
q.group_name groupQrcodeName,
db.agent_id agentId,
b.ISBN isbn,
b.BOOK_NAME bookName,
db.distribution_time distributionTime,
IF (
adp.is_open = 0
OR (
adp.is_open IS NULL
AND ap.is_open = 0
),
0,
1
) isOpen
FROM
book_group_classify c
INNER JOIN book b ON b.BOOK_ID = c.book_id
INNER JOIN book_group_qrcode q ON c.id = q.classify_id
INNER JOIN advertising_distribution_book db ON db.qrcode_id = q.id
AND db.ad_id = #{adId}
AND db.classify_id = c.id
AND db.book_id = c.book_id
LEFT JOIN advertising_agent_permission ap ON ap.agent_id = db.agent_id
LEFT JOIN advertising_adviser_permission adp ON adp.adviser_id = c.create_user
AND adp.channel_id = c.channel_id
AND adp.book_id = c.book_id
WHERE
1 = 1
<if test="name != null">
AND (b.BOOK_NAME LIKE CONCAT('%', #{name}, '%') OR q.group_name LIKE CONCAT('%', #{name}, '%'))
</if>
GROUP BY
db.qrcode_id
ORDER BY
db.distribution_time DESC
</select>
<select id="checkBookGroupAdExist" parameterType="map" resultType="Integer">
SELECT
count(1)
FROM
advertising_distribution_book b,
advertising_space s
WHERE
b.ad_id = s.id
AND b.book_id = #{bookId}
AND b.channel_id = #{channelId}
AND b.is_book_group = 1
AND s.is_open = 1
AND s.ad_position = 'BOOK_GROUP_PAGE'
AND s.ad_position_detail = #{adPositionDetail}
</select>
<select id="checkBookAdExist" parameterType="map" resultType="Integer">
SELECT
count(1)
FROM
advertising_distribution_book b,
advertising_space s
WHERE
b.ad_id = s.id
AND b.book_id = #{bookId}
AND b.channel_id = #{channelId}
AND b.is_book_group = 0
AND s.is_open = 1
AND s.ad_position = 'APP_OR_PRODUCT'
AND s.ad_position_detail = #{adPositionDetail}
AND s.ad_position_mode = #{adPositionMode}
</select>
<select id="checkQrcodeIdExist" parameterType="map" resultType="Long">
select
b.qrcode_id
from from
advertising_distribution_book b, advertising_distribution_book b,
advertising_space s advertising_space s
where where
b.ad_id = s.id b.ad_id = s.id
and b.ad_id = #{adId}
and s.is_open = 1 and s.is_open = 1
and b.book_id in and b.qrcode_id in
<foreach collection="list" index="i" item="item" open="(" <foreach collection="qrcodeIds" index="i" item="item" open="("
separator="," close=")"> separator="," close=")">
${item} ${item}
</foreach> </foreach>
group by
b.qrcode_id
</select> </select>
<select id="checkAdSpaceHasBook" parameterType="map" resultType="Boolean"> <select id="checkAdSpaceHasBook" parameterType="map" resultType="Boolean">
select select
exists ( exists (
...@@ -71,14 +191,20 @@ ...@@ -71,14 +191,20 @@
adviser_id, adviser_id,
agent_id, agent_id,
channel_id, channel_id,
is_book_group,
classify_id,
qrcode_id,
distribution_time, distribution_time,
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
#{adId,jdbcType=INTEGER}, #{adId,jdbcType=BIGINT},
#{bookId,jdbcType=INTEGER}, #{bookId,jdbcType=BIGINT},
#{adviserId,jdbcType=INTEGER}, #{adviserId,jdbcType=BIGINT},
#{agentId,jdbcType=INTEGER}, #{agentId,jdbcType=BIGINT},
#{channelId,jdbcType=INTEGER}, #{channelId,jdbcType=BIGINT},
#{isBookGroup,jdbcType=BIT},
#{classifyId,jdbcType=BIGINT},
#{qrcodeId,jdbcType=BIGINT},
NOW(), NOW(),
</trim> </trim>
</insert> </insert>
...@@ -91,15 +217,21 @@ ...@@ -91,15 +217,21 @@
adviser_id, adviser_id,
agent_id, agent_id,
channel_id, channel_id,
is_book_group,
classify_id,
qrcode_id,
distribution_time distribution_time
) values ) values
<foreach collection="list" item="item" index="index" <foreach collection="list" item="item" index="index"
separator=","> separator=",">
(#{item.adId,jdbcType=INTEGER}, (#{item.adId,jdbcType=BIGINT},
#{item.bookId,jdbcType=INTEGER}, #{item.bookId,jdbcType=BIGINT},
#{item.adviserId,jdbcType=INTEGER}, #{item.adviserId,jdbcType=BIGINT},
#{item.agentId,jdbcType=INTEGER}, #{item.agentId,jdbcType=BIGINT},
#{item.channelId,jdbcType=INTEGER}, #{item.channelId,jdbcType=BIGINT},
#{item.isBookGroup,jdbcType=BIT},
#{item.classifyId,jdbcType=BIGINT},
#{item.qrcodeId,jdbcType=BIGINT},
NOW()) NOW())
</foreach> </foreach>
</insert> </insert>
...@@ -108,21 +240,30 @@ ...@@ -108,21 +240,30 @@
update advertising_distribution_book update advertising_distribution_book
<set> <set>
<if test="adId != null"> <if test="adId != null">
ad_id = #{adId,jdbcType=INTEGER}, ad_id = #{adId,jdbcType=BIGINT},
</if> </if>
<if test="bookId != null"> <if test="bookId != null">
book_id = #{bookId,jdbcType=INTEGER}, book_id = #{bookId,jdbcType=BIGINT},
</if> </if>
<if test="adviserId != null"> <if test="adviserId != null">
adviser_id = #{adviserId,jdbcType=INTEGER}, adviser_id = #{adviserId,jdbcType=BIGINT},
</if> </if>
<if test="agentId != null"> <if test="agentId != null">
agent_id = #{agentId,jdbcType=INTEGER}, agent_id = #{agentId,jdbcType=BIGINT},
</if> </if>
<if test="channelId != null"> <if test="channelId != null">
channel_id = #{channelId,jdbcType=INTEGER}, channel_id = #{channelId,jdbcType=BIGINT},
</if>
<if test="isBookGroup != null">
is_book_group = #{isBookGroup,jdbcType=BIT},
</if>
<if test="classifyId != null">
classify_id = #{classifyId,jdbcType=BIGINT},
</if>
<if test="qrcodeId != null">
qrcode_id = #{qrcodeId,jdbcType=BIGINT},
</if> </if>
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=BIGINT}
</update> </update>
</mapper> </mapper>
\ No newline at end of file
...@@ -2,24 +2,27 @@ ...@@ -2,24 +2,27 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.advertising.dao.impl.AdvertisingExposureRecordDaoImpl"> <mapper namespace="com.pcloud.book.advertising.dao.impl.AdvertisingExposureRecordDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.advertising.entity.AdvertisingExposureRecord"> <resultMap id="BaseResultMap" type="com.pcloud.book.advertising.entity.AdvertisingExposureRecord">
<id column="id" property="id" jdbcType="INTEGER"/> <id column="id" property="id" jdbcType="BIGINT"/>
<result column="ad_id" property="adId" jdbcType="INTEGER"/> <result column="ad_id" property="adId" jdbcType="BIGINT"/>
<result column="book_id" property="bookId" jdbcType="INTEGER"/> <result column="book_id" property="bookId" jdbcType="BIGINT"/>
<result column="scene_id" property="sceneId" jdbcType="INTEGER"/> <result column="is_book_group" property="isBookGroup" jdbcType="BIT"/>
<result column="adviser_id" property="adviserId" jdbcType="INTEGER"/> <result column="scene_id" property="sceneId" jdbcType="BIGINT"/>
<result column="agent_id" property="agentId" jdbcType="INTEGER"/> <result column="adviser_id" property="adviserId" jdbcType="BIGINT"/>
<result column="channel_id" property="channelId" jdbcType="INTEGER"/> <result column="agent_id" property="agentId" jdbcType="BIGINT"/>
<result column="official_account_id" property="officialAccountId" jdbcType="INTEGER"/> <result column="channel_id" property="channelId" jdbcType="BIGINT"/>
<result column="official_account_id" property="officialAccountId" jdbcType="BIGINT"/>
<result column="from_type" property="fromType" jdbcType="VARCHAR"/> <result column="from_type" property="fromType" jdbcType="VARCHAR"/>
<result column="from_id" property="fromId" jdbcType="INTEGER"/> <result column="from_id" property="fromId" jdbcType="BIGINT"/>
<result column="wechat_user_id" property="wechatUserId" jdbcType="INTEGER"/> <result column="wechat_user_id" property="wechatUserId" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="create_day" property="createDay" jdbcType="DATE"/> <result column="create_day" property="createDay" jdbcType="DATE"/>
<result column="create_month" property="createMonth" jdbcType="VARCHAR"/>
<result column="count" property="count" jdbcType="BIGINT"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, ad_id, book_id, scene_id, adviser_id, agent_id, channel_id, official_account_id, from_type, id, ad_id, book_id, is_book_group, scene_id, adviser_id, agent_id, channel_id, official_account_id, from_type,
from_id, wechat_user_id, create_time, create_day from_id, wechat_user_id, create_time, create_day, create_month, count
</sql> </sql>
<select id="getById" resultMap="BaseResultMap" parameterType="Long"> <select id="getById" resultMap="BaseResultMap" parameterType="Long">
...@@ -31,7 +34,7 @@ ...@@ -31,7 +34,7 @@
<select id="getExposureNum" parameterType="map" resultType="Long"> <select id="getExposureNum" parameterType="map" resultType="Long">
SELECT SELECT
count(1) ifnull(sum(count), 0)
FROM FROM
advertising_exposure_record advertising_exposure_record
WHERE WHERE
...@@ -41,49 +44,114 @@ ...@@ -41,49 +44,114 @@
AND adviser_id = #{adviserId} AND adviser_id = #{adviserId}
AND channel_id = #{channelId} AND channel_id = #{channelId}
</if> </if>
<if test="fromId != null"> <if test="statisMonth != null">
AND from_id = #{fromId} and create_month = #{statisMonth}
AND from_type = #{fromType}
</if> </if>
</select> </select>
<select id="distributionDateStatics" resultType="com.pcloud.book.advertising.dto.DateCountDTO" parameterType="map"> <select id="getExposureNumByMasterId" parameterType="map" resultType="Long">
SELECT
ifnull(sum(count), 0)
FROM
advertising_exposure_record r
INNER JOIN advertising_space s ON r.ad_id = s.id
WHERE
s.master_id = #{masterId}
</select>
<select id="getExposureNumByBookId" parameterType="map" resultType="Long">
SELECT
ifnull(sum(count), 0)
FROM
advertising_exposure_record
WHERE
book_id = #{bookId}
AND adviser_id = #{adviserId}
AND channel_id = #{channelId}
AND from_type != 'WECHAT_GROUP'
</select>
<select id="getExposureNumByGroupQrcodeId" parameterType="map" resultType="Long">
SELECT
ifnull(sum(count), 0)
FROM
advertising_exposure_record
WHERE
from_id = #{qrcodeId}
AND from_type = 'WECHAT_GROUP'
<if test="adId != null">
AND ad_id = #{adId}
</if>
<if test="statisMonth != null">
AND create_month = #{statisMonth}
</if>
</select>
<select id="getTotalExposureNum" resultType="Long">
SELECT
ifnull(sum(count), 0)
FROM
advertising_exposure_record
</select>
<select id="getFlowStatisTrend" resultType="com.pcloud.book.advertising.dto.DateCountDTO" parameterType="map">
SELECT SELECT
tmp.date, tmp.date,
ifnull(count(DISTINCT er.id), 0) exposureNum, ifnull(er.exposure_num, 0) exposureNum,
ifnull(count(DISTINCT cr.id), 0) clickNum ifnull(cr.click_num, 0) clickNum
FROM FROM
<foreach collection="collectDates" index="index" item="item" open="(" separator="date union all" close="date ) tmp"> <foreach collection="collectDates" index="index" item="item" open="(" separator="date union all" close="date ) tmp">
select '${item}' select '${item}'
</foreach> </foreach>
LEFT JOIN advertising_exposure_record er ON er.create_day = tmp.date LEFT JOIN (
AND er.ad_id = #{adId} SELECT
LEFT JOIN advertising_click_record cr ON cr.create_day = tmp.date create_day,
AND cr.ad_id = #{adId} sum(count) exposure_num
FROM
advertising_exposure_record
WHERE
create_day BETWEEN #{startDate}
AND #{endDate}
GROUP BY
create_day
) er ON er.create_day = tmp.date
LEFT JOIN (
SELECT
create_day,
count(id) click_num
FROM
advertising_click_record
WHERE
create_day BETWEEN #{startDate}
AND #{endDate}
GROUP BY
create_day
) cr ON cr.create_day = tmp.date
GROUP BY GROUP BY
tmp.date tmp.date
ORDER BY ORDER BY
tmp.date tmp.date
</select> </select>
<select id="distributionAppStatics" resultType="com.pcloud.book.advertising.dto.DistributionAppDTO" parameterType="map"> <select id="advertisingWechatGroupRankTop" resultType="AdGroupQrcodeDTO">
SELECT SELECT
er.from_type fromType, r.from_id groupQrcodeId,
er.from_id fromId, q.group_name groupQrcodeName,
count(DISTINCT er.id) exposureNum, r.book_id bookId,
count(DISTINCT cr.id) clickNum b.BOOK_NAME bookName,
sum(r.count) exposureNum
FROM FROM
advertising_exposure_record er advertising_exposure_record r
LEFT JOIN advertising_click_record cr ON er.ad_id = cr.ad_id LEFT JOIN book_group_qrcode q ON q.id = r.from_id
AND er.from_type = cr.from_type LEFT JOIN book b ON b.BOOK_ID = r.book_id
AND er.from_id = cr.from_id
WHERE WHERE
er.ad_id = #{adId} r.from_type = 'WECHAT_GROUP'
GROUP BY GROUP BY
er.from_type, r.from_id
er.from_id
ORDER BY ORDER BY
er.create_time ASC exposureNum DESC,
q.id DESC
LIMIT 6
</select> </select>
<delete id="deleteById" parameterType="Long"> <delete id="deleteById" parameterType="Long">
...@@ -97,6 +165,7 @@ ...@@ -97,6 +165,7 @@
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
ad_id, ad_id,
book_id, book_id,
is_book_group,
scene_id, scene_id,
adviser_id, adviser_id,
agent_id, agent_id,
...@@ -107,57 +176,105 @@ ...@@ -107,57 +176,105 @@
wechat_user_id, wechat_user_id,
create_time, create_time,
create_day, create_day,
create_month,
count
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
#{adId,jdbcType=INTEGER}, #{adId,jdbcType=BIGINT},
#{bookId,jdbcType=INTEGER}, #{bookId,jdbcType=BIGINT},
#{sceneId,jdbcType=INTEGER}, #{isBookGroup,jdbcType=BIT},
#{adviserId,jdbcType=INTEGER}, #{sceneId,jdbcType=BIGINT},
#{agentId,jdbcType=INTEGER}, #{adviserId,jdbcType=BIGINT},
#{channelId,jdbcType=INTEGER}, #{agentId,jdbcType=BIGINT},
#{officialAccountId,jdbcType=INTEGER}, #{channelId,jdbcType=BIGINT},
#{officialAccountId,jdbcType=BIGINT},
#{fromType,jdbcType=VARCHAR}, #{fromType,jdbcType=VARCHAR},
#{fromId,jdbcType=INTEGER}, #{fromId,jdbcType=BIGINT},
#{wechatUserId,jdbcType=INTEGER}, #{wechatUserId,jdbcType=BIGINT},
NOW(), NOW(),
NOW(), NOW(),
DATE_FORMAT(NOW(), '%Y-%m'),
#{count,jdbcType=BIGINT}
</trim> </trim>
</insert> </insert>
<insert id="batchInsert" parameterType="com.pcloud.book.advertising.entity.AdvertisingExposureRecord"
useGeneratedKeys="true" keyProperty="id">
insert into advertising_exposure_record
(
ad_id,
book_id,
is_book_group,
scene_id,
adviser_id,
agent_id,
channel_id,
official_account_id,
from_type,
from_id,
wechat_user_id,
create_time,
create_day,
create_month,
count
) values
<foreach collection="list" item="item" index="index"
separator=",">
(#{item.adId,jdbcType=BIGINT},
#{item.bookId,jdbcType=BIGINT},
#{item.isBookGroup,jdbcType=BIT},
#{item.sceneId,jdbcType=BIGINT},
#{item.adviserId,jdbcType=BIGINT},
#{item.agentId,jdbcType=BIGINT},
#{item.channelId,jdbcType=BIGINT},
#{item.officialAccountId,jdbcType=BIGINT},
#{item.fromType,jdbcType=VARCHAR},
#{item.fromId,jdbcType=BIGINT},
#{item.wechatUserId,jdbcType=BIGINT},
NOW(),
NOW(),
DATE_FORMAT(NOW(), '%Y-%m'),
#{item.count,jdbcType=BIGINT})
</foreach>
</insert>
<update id="update" parameterType="com.pcloud.book.advertising.entity.AdvertisingExposureRecord"> <update id="update" parameterType="com.pcloud.book.advertising.entity.AdvertisingExposureRecord">
update advertising_exposure_record update advertising_exposure_record
<set> <set>
<if test="adId != null"> <if test="adId != null">
ad_id = #{adId,jdbcType=INTEGER}, ad_id = #{adId,jdbcType=BIGINT},
</if> </if>
<if test="bookId != null"> <if test="bookId != null">
book_id = #{bookId,jdbcType=INTEGER}, book_id = #{bookId,jdbcType=BIGINT},
</if>
<if test="isBookGroup != null">
is_book_group = #{isBookGroup,jdbcType=BIT},
</if> </if>
<if test="sceneId != null"> <if test="sceneId != null">
scene_id = #{sceneId,jdbcType=INTEGER}, scene_id = #{sceneId,jdbcType=BIGINT},
</if> </if>
<if test="adviserId != null"> <if test="adviserId != null">
adviser_id = #{adviserId,jdbcType=INTEGER}, adviser_id = #{adviserId,jdbcType=BIGINT},
</if> </if>
<if test="agentId != null"> <if test="agentId != null">
agent_id = #{agentId,jdbcType=INTEGER}, agent_id = #{agentId,jdbcType=BIGINT},
</if> </if>
<if test="channelId != null"> <if test="channelId != null">
channel_id = #{channelId,jdbcType=INTEGER}, channel_id = #{channelId,jdbcType=BIGINT},
</if> </if>
<if test="officialAccountId != null"> <if test="officialAccountId != null">
official_account_id = #{officialAccountId,jdbcType=INTEGER}, official_account_id = #{officialAccountId,jdbcType=BIGINT},
</if> </if>
<if test="fromType != null"> <if test="fromType != null">
from_type = #{fromType,jdbcType=VARCHAR}, from_type = #{fromType,jdbcType=VARCHAR},
</if> </if>
<if test="fromId != null"> <if test="fromId != null">
from_id = #{fromId,jdbcType=INTEGER}, from_id = #{fromId,jdbcType=BIGINT},
</if> </if>
<if test="wechatUserId != null"> <if test="wechatUserId != null">
wechat_user_id = #{wechatUserId,jdbcType=INTEGER}, wechat_user_id = #{wechatUserId,jdbcType=BIGINT},
</if> </if>
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=BIGINT}
</update> </update>
</mapper> </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.advertising.dao.impl.AdvertisingIncomeDailyDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.advertising.entity.AdvertisingIncomeDaily">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="ad_id" property="adId" jdbcType="BIGINT"/>
<result column="master_id" property="masterId" jdbcType="BIGINT"/>
<result column="book_id" property="bookId" jdbcType="BIGINT"/>
<result column="channel_id" property="channelId" jdbcType="BIGINT"/>
<result column="classify_id" property="classifyId" jdbcType="BIGINT"/>
<result column="qrcode_id" property="qrcodeId" jdbcType="BIGINT"/>
<result column="settlement_method" property="settlementMethod" jdbcType="VARCHAR"/>
<result column="price_each_time" property="priceEachTime" jdbcType="DECIMAL"/>
<result column="exposure_num" property="exposureNum" jdbcType="INTEGER"/>
<result column="click_num" property="clickNum" jdbcType="INTEGER"/>
<result column="income" property="income" jdbcType="DECIMAL"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="statis_day" property="statisDay" jdbcType="TIMESTAMP"/>
<result column="statis_month" property="statisMonth" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id, ad_id, master_id, book_id, channel_id, classify_id, qrcode_id, settlement_method, price_each_time,
exposure_num, click_num, income, create_time, statis_day, statis_month
</sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
select
<include refid="Base_Column_List"/>
from advertising_income_daily
where id = #{id,jdbcType=BIGINT}
</select>
<select id="getTotalIncome" resultType="Decimal">
select
ifnull(sum(income), 0)
from
advertising_income_daily
</select>
<select id="getIncomeByAdId" resultType="Decimal" parameterType="map">
select
ifnull(sum(income), 0)
from
advertising_income_daily
where
ad_id = #{adId}
<if test="bookId != null">
AND book_id = #{bookId}
AND channel_id = #{channelId}
</if>
<if test="statisMonth != null">
and statis_month = #{statisMonth}
</if>
</select>
<select id="getIncomeByMasterId" resultType="Decimal" parameterType="map">
select
ifnull(sum(income), 0)
from
advertising_income_daily
where
master_id = #{masterId}
</select>
<select id="getIncomeByBookId" resultType="Decimal" parameterType="map">
select
ifnull(sum(income), 0)
from
advertising_income_daily
where
book_id = #{bookId}
AND channel_id = #{channelId}
AND qrcode_id = 0
</select>
<select id="getIncomeByGroupQrcodeId" resultType="Decimal" parameterType="map">
select
ifnull(sum(income), 0)
from
advertising_income_daily
where
qrcode_id = #{qrcodeId}
<if test="adId != null">
and ad_id = #{adId}
</if>
<if test="statisMonth != null">
and statis_month = #{statisMonth}
</if>
</select>
<select id="getIncomeStatisTrend" resultType="com.pcloud.book.advertising.dto.DateCountDTO" parameterType="map">
SELECT
tmp.date,
ifnull(sum(d.income), 0) income
FROM
<foreach collection="collectDates" index="index" item="item" open="(" separator="date union all" close="date ) tmp">
select '${item}'
</foreach>
LEFT JOIN advertising_income_daily d ON d.statis_day = tmp.date
GROUP BY
tmp.date
ORDER BY
tmp.date
</select>
<delete id="deleteById" parameterType="java.lang.Long">
delete from advertising_income_daily
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.pcloud.book.advertising.entity.AdvertisingIncomeDaily"
useGeneratedKeys="true" keyProperty="id">
insert into advertising_income_daily
<trim prefix="(" suffix=")" suffixOverrides=",">
ad_id,
master_id,
book_id,
channel_id,
classify_id,
qrcode_id,
settlement_method,
price_each_time,
exposure_num,
click_num,
income,
create_time,
statis_day,
statis_month,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{adId,jdbcType=BIGINT},
#{masterId,jdbcType=BIGINT},
#{bookId,jdbcType=BIGINT},
#{channelId,jdbcType=BIGINT},
#{classifyId,jdbcType=BIGINT},
#{qrcodeId,jdbcType=BIGINT},
#{settlementMethod,jdbcType=VARCHAR},
#{priceEachTime,jdbcType=DECIMAL},
#{exposureNum,jdbcType=INTEGER},
#{clickNum,jdbcType=INTEGER},
#{income,jdbcType=DECIMAL},
NOW(),
#{statisDay,jdbcType=TIMESTAMP},
#{statisMonth,jdbcType=VARCHAR},
</trim>
</insert>
<insert id="insertRecordWithoutWechatGroupMsgAd" parameterType="map" useGeneratedKeys="true" keyProperty="id">
INSERT INTO advertising_income_daily (
ad_id,
master_id,
book_id,
channel_id,
classify_id,
qrcode_id,
settlement_method,
price_each_time,
exposure_num,
click_num,
income,
create_time,
statis_day,
statis_month
) SELECT
b.ad_id,
s.master_id,
b.book_id,
b.channel_id,
ifnull(b.classify_id, 0),
ifnull(b.qrcode_id, 0),
m.settlement_method,
m.price_each_time,
ifnull(er.exposure_num, 0) exposure_num,
ifnull(cr.click_num, 0) click_num,
(
CASE m.settlement_method
WHEN 'CPC' THEN
ifnull(cr.click_num, 0) * m.price_each_time
WHEN 'CPM' THEN
ifnull(er.exposure_num, 0) * m.price_each_time
ELSE
0
END
) income,
now(),
#{createDay},
DATE_FORMAT(#{createDay}, '%Y-%m')
FROM
advertising_settlement_method m,
advertising_space s,
advertising_distribution_book b
LEFT JOIN (
SELECT
ad_id,
book_id,
channel_id,
sum(count) exposure_num
FROM
advertising_exposure_record
WHERE
create_day = #{createDay}
AND from_type != 'WECHAT_GROUP'
GROUP BY
ad_id,
book_id,
channel_id
) er ON er.ad_id = b.ad_id
AND er.book_id = b.book_id
AND er.channel_id = b.channel_id
LEFT JOIN (
SELECT
ad_id,
book_id,
channel_id,
count(id) click_num
FROM
advertising_click_record
WHERE
create_day = #{createDay}
AND from_type != 'WECHAT_GROUP'
GROUP BY
ad_id,
book_id,
channel_id
) cr ON cr.ad_id = b.ad_id
AND cr.book_id = b.book_id
AND cr.channel_id = b.channel_id
WHERE
b.ad_id = s.id
AND s.id = m.ad_id
AND (
s.ad_position = 'BOOK_GROUP_PAGE'
OR s.ad_position = 'APP_OR_PRODUCT'
)
AND b.qrcode_id IS NULL
GROUP BY
b.ad_id,
b.book_id,
b.channel_id
HAVING
income > 0
</insert>
<insert id="insertWechatGroupMsgAdRecord" parameterType="map" useGeneratedKeys="true" keyProperty="id">
INSERT INTO advertising_income_daily (
ad_id,
master_id,
book_id,
channel_id,
classify_id,
qrcode_id,
settlement_method,
price_each_time,
exposure_num,
click_num,
income,
create_time,
statis_day,
statis_month
) SELECT
b.ad_id,
s.master_id,
b.book_id,
b.channel_id,
ifnull(b.classify_id, 0),
ifnull(b.qrcode_id, 0),
m.settlement_method,
m.price_each_time,
ifnull(er.exposure_num, 0) exposure_num,
ifnull(cr.click_num, 0) click_num,
(
CASE m.settlement_method
WHEN 'CPC' THEN
ifnull(cr.click_num, 0) * m.price_each_time
WHEN 'CPM' THEN
ifnull(er.exposure_num, 0) * m.price_each_time
ELSE
0
END
) income,
now(),
#{createDay},
DATE_FORMAT(#{createDay}, '%Y-%m')
FROM
advertising_settlement_method m,
advertising_space s,
advertising_distribution_book b
LEFT JOIN (
SELECT
ad_id,
book_id,
channel_id,
from_id,
sum(count) exposure_num
FROM
advertising_exposure_record
WHERE
create_day = #{createDay}
AND from_type = 'WECHAT_GROUP'
GROUP BY
ad_id,
book_id,
channel_id,
from_id
) er ON er.ad_id = b.ad_id
AND er.book_id = b.book_id
AND er.channel_id = b.channel_id
AND er.from_id = b.qrcode_id
LEFT JOIN (
SELECT
ad_id,
book_id,
channel_id,
from_id,
count(id) click_num
FROM
advertising_click_record
WHERE
create_day = #{createDay}
AND from_type = 'WECHAT_GROUP'
GROUP BY
ad_id,
book_id,
channel_id,
from_id
) cr ON cr.ad_id = b.ad_id
AND cr.book_id = b.book_id
AND cr.channel_id = b.channel_id
AND cr.from_id = b.qrcode_id
WHERE
b.ad_id = s.id
AND s.id = m.ad_id
AND s.ad_position = 'WECHAT_GROUP_MSG'
AND b.qrcode_id IS NOT NULL
GROUP BY
b.ad_id,
b.book_id,
b.channel_id,
b.classify_id,
b.qrcode_id
HAVING
income > 0
</insert>
<update id="update" parameterType="com.pcloud.book.advertising.entity.AdvertisingIncomeDaily">
update advertising_income_daily
<set>
<if test="adId != null">
ad_id = #{adId,jdbcType=BIGINT},
</if>
<if test="masterId != null">
master_id = #{masterId,jdbcType=BIGINT},
</if>
<if test="bookId != null">
book_id = #{bookId,jdbcType=BIGINT},
</if>
<if test="channelId != null">
channel_id = #{channelId,jdbcType=BIGINT},
</if>
<if test="classifyId != null">
classify_id = #{classifyId,jdbcType=BIGINT},
</if>
<if test="qrcodeId != null">
qrcode_id = #{qrcodeId,jdbcType=BIGINT},
</if>
<if test="settlementMethod != null">
settlement_method = #{settlementMethod,jdbcType=VARCHAR},
</if>
<if test="priceEachTime != null">
price_each_time = #{priceEachTime,jdbcType=DECIMAL},
</if>
<if test="exposureNum != null">
exposure_num = #{exposureNum,jdbcType=INTEGER},
</if>
<if test="clickNum != null">
click_num = #{clickNum,jdbcType=INTEGER},
</if>
<if test="income != null">
income = #{income,jdbcType=DECIMAL},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="statisDay != null">
statis_day = #{statisDay,jdbcType=TIMESTAMP},
</if>
<if test="statisMonth != null">
statis_month = #{statisMonth,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
</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.advertising.dao.impl.AdvertisingMasterDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.advertising.entity.AdvertisingMaster">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="master_name" property="masterName" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
</resultMap>
<resultMap id="AdvertisingMasterDTO" type="com.pcloud.book.advertising.dto.AdvertisingMasterDTO">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="master_name" property="masterName" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, master_name, create_time, update_time
</sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
select
<include refid="Base_Column_List"/>
from advertising_master
where id = #{id,jdbcType=BIGINT}
</select>
<select id="getDTOById" resultMap="AdvertisingMasterDTO" parameterType="java.lang.Long">
select
<include refid="Base_Column_List"/>
from advertising_master
where id = #{id,jdbcType=BIGINT}
</select>
<select id="checkMasterNameExist" resultMap="BaseResultMap" parameterType="java.lang.Long">
select
exists (
select
id
from
advertising_master
where
master_name = #{masterName,jdbcType=VARCHAR}
<if test="masterId != null">
and id != #{masterId,jdbcType=BIGINT}
</if>
)
</select>
<delete id="deleteById" parameterType="java.lang.Long">
delete from advertising_master
where id = #{id,jdbcType=BIGINT}
</delete>
<select id="getMasterList" parameterType="map" resultMap="AdvertisingMasterDTO">
select
m.id,
m.master_name,
m.create_time,
m.update_time,
count(s.id) spaceNum
from
advertising_master m
left join advertising_space s on s.master_id = m.id
where 1 = 1
<if test="null != masterName and masterName != ''">
and m.master_name like concat('%', #{masterName}, '%')
</if>
group by
m.id
</select>
<select id="getAllMaster" resultMap="AdvertisingMasterDTO">
select
<include refid="Base_Column_List"/>
from advertising_master
</select>
<insert id="insert" parameterType="com.pcloud.book.advertising.entity.AdvertisingMaster"
useGeneratedKeys="true" keyProperty="id">
insert into advertising_master
<trim prefix="(" suffix=")" suffixOverrides=",">
master_name,
create_time,
update_time,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{masterName,jdbcType=VARCHAR},
NOW(),
NOW(),
</trim>
</insert>
<update id="update" parameterType="com.pcloud.book.advertising.entity.AdvertisingMaster">
update advertising_master
<set>
<if test="masterName != null">
master_name = #{masterName,jdbcType=VARCHAR},
</if>
update_time = NOW(),
</set>
where id = #{id,jdbcType=BIGINT}
</update>
</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.advertising.dao.impl.AdvertisingSettlementMethodDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.advertising.entity.AdvertisingSettlementMethod">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="master_id" property="masterId" jdbcType="BIGINT"/>
<result column="ad_id" property="adId" jdbcType="BIGINT"/>
<result column="settlement_method" property="settlementMethod" jdbcType="VARCHAR"/>
<result column="price_each_time" property="priceEachTime" jdbcType="DECIMAL"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
</resultMap>
<resultMap id="AdvertisingSettlementMethodDTO" type="com.pcloud.book.advertising.dto.AdvertisingSettlementMethodDTO">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="master_id" property="masterId" jdbcType="BIGINT"/>
<result column="ad_id" property="adId" jdbcType="BIGINT"/>
<result column="settlement_method" property="settlementMethod" jdbcType="VARCHAR"/>
<result column="price_each_time" property="priceEachTime" jdbcType="DECIMAL"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, master_id, ad_id, settlement_method, price_each_time, create_time, update_time
</sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
select
<include refid="Base_Column_List"/>
from advertising_settlement_method
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteById" parameterType="java.lang.Long">
delete from advertising_settlement_method
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByMasterId" parameterType="java.lang.Long">
delete from advertising_settlement_method
where master_id = #{masterId,jdbcType=BIGINT}
and ad_id is null
</delete>
<select id="getByMasterId" parameterType="java.lang.Long" resultMap="AdvertisingSettlementMethodDTO">
select
<include refid="Base_Column_List"/>
from advertising_settlement_method
where master_id = #{masterId,jdbcType=BIGINT}
and ad_id is null
</select>
<select id="getByMasterIdAndAdId" parameterType="map" resultMap="AdvertisingSettlementMethodDTO">
select
<include refid="Base_Column_List"/>
from advertising_settlement_method
where master_id = #{masterId,jdbcType=BIGINT}
and ad_id = #{adId,jdbcType=BIGINT}
order by create_time desc
limit 1
</select>
<insert id="insert" parameterType="com.pcloud.book.advertising.entity.AdvertisingSettlementMethod"
useGeneratedKeys="true" keyProperty="id">
insert into advertising_settlement_method
<trim prefix="(" suffix=")" suffixOverrides=",">
master_id,
ad_id,
settlement_method,
price_each_time,
create_time,
update_time,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{masterId,jdbcType=BIGINT},
#{adId,jdbcType=BIGINT},
#{settlementMethod,jdbcType=VARCHAR},
#{priceEachTime,jdbcType=DECIMAL},
NOW(),
NOW(),
</trim>
</insert>
<insert id="batchInsert" parameterType="com.pcloud.book.advertising.entity.AdvertisingSettlementMethod"
useGeneratedKeys="true" keyProperty="id">
insert into advertising_settlement_method (
master_id,
ad_id,
settlement_method,
price_each_time,
create_time,
update_time
) values
<foreach collection="list" item="item" index="index"
separator=",">
(#{item.masterId,jdbcType=BIGINT},
#{item.adId,jdbcType=BIGINT},
#{item.settlementMethod,jdbcType=VARCHAR},
#{item.priceEachTime,jdbcType=DECIMAL},
NOW(),
NOW())
</foreach>
</insert>
<update id="update" parameterType="com.pcloud.book.advertising.entity.AdvertisingSettlementMethod">
update advertising_settlement_method
<set>
<if test="masterId != null">
master_id = #{masterId,jdbcType=BIGINT},
</if>
<if test="adId != null">
ad_id = #{adId,jdbcType=BIGINT},
</if>
<if test="settlementMethod != null">
settlement_method = #{settlementMethod,jdbcType=VARCHAR},
</if>
<if test="priceEachTime != null">
price_each_time = #{priceEachTime,jdbcType=DECIMAL},
</if>
update_time = NOW(),
</set>
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
...@@ -2,38 +2,42 @@ ...@@ -2,38 +2,42 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.advertising.dao.impl.AdvertisingSpaceDaoImpl"> <mapper namespace="com.pcloud.book.advertising.dao.impl.AdvertisingSpaceDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.advertising.entity.AdvertisingSpace"> <resultMap id="BaseResultMap" type="com.pcloud.book.advertising.entity.AdvertisingSpace">
<id column="id" property="id" jdbcType="INTEGER"/> <id column="id" property="id" jdbcType="BIGINT"/>
<result column="ad_name" property="adName" jdbcType="VARCHAR"/> <result column="ad_name" property="adName" jdbcType="VARCHAR"/>
<result column="ad_position" property="adPosition" jdbcType="VARCHAR"/> <result column="ad_position" property="adPosition" jdbcType="VARCHAR"/>
<result column="ad_source" property="adSource" jdbcType="VARCHAR"/> <result column="ad_position_mode" property="adPositionMode" jdbcType="VARCHAR"/>
<result column="ad_position_detail" property="adPositionDetail" jdbcType="VARCHAR"/>
<result column="master_id" property="masterId" jdbcType="BIGINT"/>
<result column="ad_link" property="adLink" jdbcType="VARCHAR"/> <result column="ad_link" property="adLink" jdbcType="VARCHAR"/>
<result column="source_id" property="sourceId" jdbcType="VARCHAR"/> <result column="source_id" property="sourceId" jdbcType="VARCHAR"/>
<result column="ad_title" property="adTitle" jdbcType="VARCHAR"/>
<result column="ad_slogan" property="adSlogan" jdbcType="VARCHAR"/> <result column="ad_slogan" property="adSlogan" jdbcType="VARCHAR"/>
<result column="ad_pic" property="adPic" jdbcType="VARCHAR"/> <result column="ad_pic" property="adPic" jdbcType="VARCHAR"/>
<result column="distribution_type" property="distributionType" jdbcType="BIT"/>
<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="is_open" property="isOpen" jdbcType="BIT"/> <result column="is_open" property="isOpen" jdbcType="BIT"/>
</resultMap> </resultMap>
<resultMap id="AdvertisingSpaceDTO" type="com.pcloud.book.advertising.dto.AdvertisingSpaceDTO"> <resultMap id="AdvertisingSpaceDTO" type="com.pcloud.book.advertising.dto.AdvertisingSpaceDTO">
<id column="id" property="id" jdbcType="INTEGER"/> <id column="id" property="id" jdbcType="BIGINT"/>
<result column="ad_name" property="adName" jdbcType="VARCHAR"/> <result column="ad_name" property="adName" jdbcType="VARCHAR"/>
<result column="ad_position" property="adPosition" jdbcType="VARCHAR"/> <result column="ad_position" property="adPosition" jdbcType="VARCHAR"/>
<result column="ad_source" property="adSource" jdbcType="VARCHAR"/> <result column="ad_position_mode" property="adPositionMode" jdbcType="VARCHAR"/>
<result column="ad_position_detail" property="adPositionDetail" jdbcType="VARCHAR"/>
<result column="master_id" property="masterId" jdbcType="BIGINT"/>
<result column="ad_link" property="adLink" jdbcType="VARCHAR"/> <result column="ad_link" property="adLink" jdbcType="VARCHAR"/>
<result column="source_id" property="sourceId" jdbcType="VARCHAR"/> <result column="source_id" property="sourceId" jdbcType="VARCHAR"/>
<result column="ad_title" property="adTitle" jdbcType="VARCHAR"/>
<result column="ad_slogan" property="adSlogan" jdbcType="VARCHAR"/> <result column="ad_slogan" property="adSlogan" jdbcType="VARCHAR"/>
<result column="ad_pic" property="adPic" jdbcType="VARCHAR"/> <result column="ad_pic" property="adPic" jdbcType="VARCHAR"/>
<result column="distribution_type" property="distributionType" jdbcType="BIT"/>
<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="is_open" property="isOpen" jdbcType="BIT"/> <result column="is_open" property="isOpen" jdbcType="BIT"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, ad_name, ad_position, ad_source, ad_link, source_id, ad_slogan, ad_pic, distribution_type, id, ad_name, ad_position, ad_position_mode, ad_position_detail, master_id, ad_link, source_id,
create_time, update_time, is_open ad_title, ad_slogan, ad_pic, create_time, update_time, is_open
</sql> </sql>
<select id="getById" resultMap="BaseResultMap" parameterType="Long"> <select id="getById" resultMap="BaseResultMap" parameterType="Long">
...@@ -56,8 +60,10 @@ ...@@ -56,8 +60,10 @@
s.ad_name, s.ad_name,
s.ad_link, s.ad_link,
s.ad_position, s.ad_position,
s.ad_source, s.ad_position_detail,
s.ad_position_mode,
s.source_id, s.source_id,
s.ad_title,
s.ad_slogan, s.ad_slogan,
s.ad_pic s.ad_pic
FROM FROM
...@@ -66,32 +72,48 @@ ...@@ -66,32 +72,48 @@
WHERE WHERE
b.ad_id = s.id b.ad_id = s.id
AND s.is_open = 1 AND s.is_open = 1
AND s.ad_position_detail = #{adPositionDetail}
AND b.book_id = #{bookId} AND b.book_id = #{bookId}
AND b.adviser_id = #{adviserId} AND b.adviser_id = #{adviserId}
AND b.channel_id = #{channelId} AND b.channel_id = #{channelId}
AND b.is_book_group = 0
ORDER BY ORDER BY
b.distribution_time DESC b.distribution_time DESC
LIMIT 1
</select> </select>
<select id="getNoSignBookAd" resultMap="AdvertisingSpaceDTO" parameterType="map"> <select id="getDTOByBookId4BookGroup" resultMap="AdvertisingSpaceDTO" parameterType="map">
SELECT SELECT
s.id, s.id,
s.ad_name, s.ad_name,
s.ad_link, s.ad_link,
s.ad_position, s.ad_position,
s.ad_source, s.ad_position_detail,
s.ad_position_mode,
s.source_id, s.source_id,
s.ad_title,
s.ad_slogan, s.ad_slogan,
s.ad_pic s.ad_pic
FROM FROM
advertising_distribution_book b,
advertising_space s advertising_space s
WHERE WHERE
s.is_open = 1 b.ad_id = s.id
and s.distribution_type = 1 AND s.is_open = 1
AND s.ad_position_detail = #{adPositionDetail}
AND b.book_id = #{bookId}
AND b.adviser_id = #{adviserId}
AND b.channel_id = #{channelId}
AND b.is_book_group = 1
ORDER BY ORDER BY
s.create_time DESC b.distribution_time DESC
LIMIT 1 limit 1
</select>
<select id="getSpaceNum" resultType="Long">
select
count(1)
from
advertising_space
</select> </select>
<select id="list" parameterType="map" resultMap="AdvertisingSpaceDTO"> <select id="list" parameterType="map" resultMap="AdvertisingSpaceDTO">
...@@ -102,8 +124,87 @@ ...@@ -102,8 +124,87 @@
<if test="name != null"> <if test="name != null">
AND (ad_name LIKE CONCAT('%', #{name}, '%') OR source_id LIKE CONCAT(#{name},'%')) AND (ad_name LIKE CONCAT('%', #{name}, '%') OR source_id LIKE CONCAT(#{name},'%'))
</if> </if>
order by
create_time desc
</select>
<select id="advertisingDetail4Book" parameterType="map" resultMap="AdvertisingSpaceDTO">
SELECT
s.id,
s.ad_name,
s.ad_position,
s.ad_position_detail,
s.ad_position_mode,
s.master_id,
s.ad_pic,
s.is_open,
b.distribution_time distributionTime
FROM
advertising_distribution_book b,
advertising_space s
WHERE
b.ad_id = s.id
AND b.book_id = #{bookId}
AND b.channel_id = #{channelId}
AND b.adviser_id = #{adviserId}
AND s.ad_position != 'WECHAT_GROUP_MSG'
ORDER BY
b.distribution_time DESC
</select>
<select id="advertisingDetail4WechatGroup" parameterType="map" resultMap="AdvertisingSpaceDTO">
SELECT
s.id,
s.ad_name,
s.ad_position,
s.ad_position_detail,
s.ad_position_mode,
s.master_id,
s.ad_pic,
s.ad_link,
s.is_open,
b.distribution_time distributionTime
FROM
advertising_distribution_book b,
advertising_space s
WHERE
b.ad_id = s.id
AND b.qrcode_id = #{qrcodeId}
AND s.ad_position = 'WECHAT_GROUP_MSG'
ORDER BY
b.distribution_time DESC
</select>
<select id="advertisingDetail4Master" parameterType="map" resultMap="AdvertisingSpaceDTO">
SELECT
s.id,
s.ad_name,
s.ad_position,
s.ad_position_detail,
s.ad_position_mode,
s.master_id,
s.source_id,
s.ad_pic,
s.is_open,
b.distribution_time distributionTime,
b.book_id bookId,
b.qrcode_id qrcodeId,
b.agent_id agentId,
b.adviser_id adviserId,
b. channel_id channelId
FROM
advertising_space s
LEFT JOIN advertising_distribution_book b ON b.ad_id = s.id
WHERE
s.master_id = #{masterId}
GROUP BY
s.id,
b.book_id,
b.channel_id,
b.classify_id,
b.qrcode_id
ORDER BY ORDER BY
create_time DESC b.distribution_time DESC
</select> </select>
<delete id="deleteById" parameterType="Long"> <delete id="deleteById" parameterType="Long">
...@@ -117,12 +218,14 @@ ...@@ -117,12 +218,14 @@
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
ad_name, ad_name,
ad_position, ad_position,
ad_source, ad_position_mode,
ad_position_detail,
master_id,
ad_link, ad_link,
source_id, source_id,
ad_title,
ad_slogan, ad_slogan,
ad_pic, ad_pic,
distribution_type,
create_time, create_time,
update_time, update_time,
is_open, is_open,
...@@ -130,12 +233,14 @@ ...@@ -130,12 +233,14 @@
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
#{adName,jdbcType=VARCHAR}, #{adName,jdbcType=VARCHAR},
#{adPosition,jdbcType=VARCHAR}, #{adPosition,jdbcType=VARCHAR},
#{adSource,jdbcType=VARCHAR}, #{adPositionMode,jdbcType=VARCHAR},
#{adPositionDetail,jdbcType=VARCHAR},
#{masterId,jdbcType=BIGINT},
#{adLink,jdbcType=VARCHAR}, #{adLink,jdbcType=VARCHAR},
#{sourceId,jdbcType=VARCHAR}, #{sourceId,jdbcType=VARCHAR},
#{adTitle,jdbcType=VARCHAR},
#{adSlogan,jdbcType=VARCHAR}, #{adSlogan,jdbcType=VARCHAR},
#{adPic,jdbcType=VARCHAR}, #{adPic,jdbcType=VARCHAR},
#{distributionType,jdbcType=BIT},
NOW(), NOW(),
NOW(), NOW(),
#{isOpen,jdbcType=BIT}, #{isOpen,jdbcType=BIT},
...@@ -151,8 +256,14 @@ ...@@ -151,8 +256,14 @@
<if test="adPosition != null"> <if test="adPosition != null">
ad_position = #{adPosition,jdbcType=VARCHAR}, ad_position = #{adPosition,jdbcType=VARCHAR},
</if> </if>
<if test="adSource != null"> <if test="adPositionMode != null">
ad_source = #{adSource,jdbcType=VARCHAR}, ad_position_mode = #{adPositionMode,jdbcType=VARCHAR},
</if>
<if test="adPositionDetail != null">
ad_position_detail = #{adPositionDetail,jdbcType=VARCHAR},
</if>
<if test="masterId != null">
master_id = #{masterId,jdbcType=BIGINT},
</if> </if>
<if test="adLink != null"> <if test="adLink != null">
ad_link = #{adLink,jdbcType=VARCHAR}, ad_link = #{adLink,jdbcType=VARCHAR},
...@@ -160,15 +271,15 @@ ...@@ -160,15 +271,15 @@
<if test="sourceId != null"> <if test="sourceId != null">
source_id = #{sourceId,jdbcType=VARCHAR}, source_id = #{sourceId,jdbcType=VARCHAR},
</if> </if>
<if test="adTitle != null">
ad_title = #{adTitle,jdbcType=VARCHAR},
</if>
<if test="adSlogan != null"> <if test="adSlogan != null">
ad_slogan = #{adSlogan,jdbcType=VARCHAR}, ad_slogan = #{adSlogan,jdbcType=VARCHAR},
</if> </if>
<if test="adPic != null"> <if test="adPic != null">
ad_pic = #{adPic,jdbcType=VARCHAR}, ad_pic = #{adPic,jdbcType=VARCHAR},
</if> </if>
<if test="distributionType != null">
distribution_type = #{distributionType,jdbcType=BIT},
</if>
update_time = NOW(), update_time = NOW(),
<if test="isOpen != null"> <if test="isOpen != null">
is_open = #{isOpen,jdbcType=BIT}, is_open = #{isOpen,jdbcType=BIT},
......
...@@ -726,7 +726,7 @@ ...@@ -726,7 +726,7 @@
</select> </select>
<!-- 获取书籍列表(编辑) --> <!-- 获取书籍列表(编辑) -->
<select id="listBook4AdvertisingSpaceNoSignBook" resultMap="bookMap" parameterType="map"> <select id="advertisingBookList" resultMap="bookMap" parameterType="map">
SELECT SELECT
a.BOOK_ID, a.BOOK_ID,
a.CHANNEL_ID, a.CHANNEL_ID,
...@@ -735,37 +735,25 @@ ...@@ -735,37 +735,25 @@
b.ISBN, b.ISBN,
b.BOOK_NAME, b.BOOK_NAME,
b.COVER_IMG, b.COVER_IMG,
IF ( count(DISTINCT db.id) advertisingSpaceNum,
adp.is_open = 0 IF (
OR ( adp.is_open = 0
adp.is_open IS NULL OR (
AND ap.is_open = 0 adp.is_open IS NULL
), AND ap.is_open = 0
0, ),
1 0,
) isOpen 1
) isOpen
FROM FROM
BOOK_ADVISER a BOOK_ADVISER a
INNER JOIN BOOK b ON a.BOOK_ID = b.BOOK_ID INNER JOIN BOOK b ON a.BOOK_ID = b.BOOK_ID
AND a.IS_DELETE = 0 AND a.IS_DELETE = 0
AND b.IS_DELETE = 0 AND b.IS_DELETE = 0
INNER JOIN ( INNER JOIN advertising_distribution_book db ON db.book_id = a.BOOK_ID
SELECT
book_id,
adviser_id,
channel_id,
agent_id
FROM
advertising_exposure_record
WHERE
ad_id = #{adId}
GROUP BY
book_id,
adviser_id,
channel_id
) db ON db.book_id = a.BOOK_ID
AND db.channel_id = a.CHANNEL_ID AND db.channel_id = a.CHANNEL_ID
AND db.adviser_id = a.ADVISER_ID AND db.adviser_id = a.ADVISER_ID
AND db.qrcode_id IS NULL
LEFT JOIN advertising_agent_permission ap ON ap.agent_id = db.agent_id LEFT JOIN advertising_agent_permission ap ON ap.agent_id = db.agent_id
LEFT JOIN advertising_adviser_permission adp ON adp.adviser_id = a.ADVISER_ID LEFT JOIN advertising_adviser_permission adp ON adp.adviser_id = a.ADVISER_ID
AND adp.channel_id = a.CHANNEL_ID AND adp.channel_id = a.CHANNEL_ID
...@@ -779,7 +767,7 @@ ...@@ -779,7 +767,7 @@
a.BOOK_ID, a.BOOK_ID,
a.CHANNEL_ID a.CHANNEL_ID
ORDER BY ORDER BY
a.CREATED_DATE DESC db.id ASC
</select> </select>
<!-- 获取书籍列表(平台) --> <!-- 获取书籍列表(平台) -->
...@@ -809,9 +797,14 @@ ...@@ -809,9 +797,14 @@
FROM FROM
BOOK_ADVISER a BOOK_ADVISER a
INNER JOIN BOOK b ON a.BOOK_ID = b.BOOK_ID INNER JOIN BOOK b ON a.BOOK_ID = b.BOOK_ID
AND a.ADVISER_ID = #{adviserId}
AND a.IS_DELETE = 0 AND a.IS_DELETE = 0
AND b.IS_DELETE = 0 AND b.IS_DELETE = 0
<if test="bookGroupOnly != null and bookGroupOnly == 1">
INNER JOIN book_group g ON g.BOOK_ID = a.BOOK_ID
AND g.CHANNEL_ID = a.CHANNEL_ID
AND g.CREATE_USER = a.ADVISER_ID
AND g.IS_DELETE = 0
</if>
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
db.id, db.id,
...@@ -828,14 +821,23 @@ ...@@ -828,14 +821,23 @@
AND t.book_id = a.BOOK_ID AND t.book_id = a.BOOK_ID
WHERE WHERE
a.IS_MAIN_EDITOR = 1 a.IS_MAIN_EDITOR = 1
<if test="adviserId != null">
AND a.ADVISER_ID = #{adviserId}
</if>
<if test="name != null"> <if test="name != null">
AND (b.BOOK_NAME LIKE CONCAT('%', #{name}, '%') OR b.ISBN LIKE CONCAT(#{name},'%')) AND (b.BOOK_NAME LIKE CONCAT('%', #{name}, '%') OR b.ISBN LIKE CONCAT(#{name},'%'))
</if> </if>
GROUP BY GROUP BY
a.BOOK_ID, a.BOOK_ID,
a.CHANNEL_ID a.CHANNEL_ID
ORDER BY <if test="bookGroupOnly != null and bookGroupOnly == 1">
a.CREATED_DATE DESC ORDER BY
g.create_time DESC
</if>
<if test="bookGroupOnly == null or bookGroupOnly != 1">
ORDER BY
a.CREATED_DATE DESC
</if>
</select> </select>
<!-- 获取书籍列表(编辑) --> <!-- 获取书籍列表(编辑) -->
...@@ -1183,7 +1185,7 @@ ...@@ -1183,7 +1185,7 @@
<!-- 图书列表(平台端) --> <!-- 图书列表(平台端) -->
<select id="listBookClassify" resultMap="bookMap" parameterType="map"> <select id="listBookClassify" resultMap="bookMap" parameterType="map">
SELECT SELECT
b.BOOK_ID, b.BOOK_NAME, b.COVER_IMG, b.ISBN, b.PUBLISH, b.BOOK_ID, b.BOOK_NAME, b.COVER_IMG, b.ISBN, b.PUBLISH, b.SERIAL_NUMBER,
ba.ADVISER_ID, ba.TEMPLET_ID, ba.CHANNEL_ID, ba.CREATED_DATE, ba.ADVISER_ID, ba.TEMPLET_ID, ba.CHANNEL_ID, ba.CREATED_DATE,
bt.TYPE_NAME bt.TYPE_NAME
FROM FROM
......
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