Commit c685848f by 田超

Merge branch 'feature/1003253' into 'master'

feat: [1003253] 改资讯的数据统计UV点击和流量方式为独立访客累计

See merge request rays/pcloud-book!835
parents 25c8c3d8 8a6e617e
......@@ -205,7 +205,8 @@ public interface AppletNewsBiz {
*/
PageBeanNew<AppletNewsDTO> listAppletNews4Analysis(Integer currentPage, Integer numPerPage, String name,
Long firstClassify,Long secondClassify,Long gradeLabelId,
Long subjectLabelId,Integer linkOnly,Long rightsClassifyId);
Long subjectLabelId,Integer linkOnly,Long rightsClassifyId,
String source,Integer browseQty,Integer clickQty);
/**
*
......
......@@ -430,7 +430,7 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
return;
}
List<Long> newsIds = recordList.stream().filter(s -> s != null).map(AppletNewsDTO::getId).distinct().collect(Collectors.toList());
Map<Long, PvuvDTO> browseMap = appletLinkClickDao.mapPVUV(DataTypeEnum.news.code, DataRecordTypeEnum.browse.code, newsIds);
Map<Long, PvuvDTO> browseMap = appletLinkClickDao.mapPVUV(DataTypeEnum.news.code, DataRecordTypeEnum.browse.code, newsIds,null);
for (AppletNewsDTO appletNewsDTO : recordList) {
Long newsId = appletNewsDTO.getId();
if (!MapUtils.isEmpty(browseMap) && browseMap.containsKey(newsId)) {
......@@ -604,7 +604,8 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
}
@Override
public PageBeanNew<AppletNewsDTO> listAppletNews4Analysis(Integer currentPage, Integer numPerPage, String name, Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, Integer linkOnly,Long rightsClassifyId) {
public PageBeanNew<AppletNewsDTO> listAppletNews4Analysis(Integer currentPage, Integer numPerPage, String name, Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, Integer linkOnly,Long rightsClassifyId,
String source,Integer browseQty,Integer clickQty) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("name", name);
paramMap.put("linkOnly", linkOnly);
......@@ -625,13 +626,15 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
paramMap.put("gradeLabelId", gradeLabelId);
paramMap.put("subjectLabelId", subjectLabelId);
}
paramMap.put("source", source);
PageBeanNew<AppletNewsDTO> pageBeanNew = appletNewsDao.listPageNew(
new PageParam(currentPage,numPerPage) ,paramMap,"listAppletNews4Analysis");
if (null == pageBeanNew || ListUtils.isEmpty(pageBeanNew.getRecordList())){
return new PageBeanNew<>(currentPage,numPerPage,0,new ArrayList<>());
}
setLabelContent(pageBeanNew.getRecordList());
fillStatistic(pageBeanNew.getRecordList());
fillStatistic(pageBeanNew.getRecordList(),browseQty,clickQty);
return pageBeanNew;
}
......@@ -641,13 +644,19 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
* @date:2020/5/11 20:09
* * @param null
*/
private void fillStatistic(List<AppletNewsDTO> recordList) {
private void fillStatistic(List<AppletNewsDTO> recordList,Integer browseQty,Integer clickQty) {
if (ListUtils.isEmpty(recordList)) {
return;
}
if (null != browseQty && browseQty.intValue()>1){ //等于1 值查询当天数据。大于1时,从昨天开始倒推7天,所以要+1
browseQty += 1;
}
if (null != clickQty && clickQty.intValue() >1){
clickQty += 1;
}
List<Long> newsIds = recordList.stream().filter(s -> s != null).map(AppletNewsDTO::getId).distinct().collect(Collectors.toList());
Map<Long, PvuvDTO> clickMap = appletLinkClickDao.mapPVUV(DataTypeEnum.news.code, DataRecordTypeEnum.click.code, newsIds);
Map<Long, PvuvDTO> browseMap = appletLinkClickDao.mapPVUV(DataTypeEnum.news.code, DataRecordTypeEnum.browse.code, newsIds);
Map<Long, PvuvDTO> clickMap = appletLinkClickDao.mapPVUV(DataTypeEnum.news.code, DataRecordTypeEnum.click.code, newsIds,clickQty);
Map<Long, PvuvDTO> browseMap = appletLinkClickDao.mapPVUV(DataTypeEnum.news.code, DataRecordTypeEnum.browse.code, newsIds,browseQty);
for (AppletNewsDTO appletNewsDTO : recordList) {
Long newsId = appletNewsDTO.getId();
if (!MapUtils.isEmpty(clickMap) && clickMap.containsKey(newsId)) {
......
......@@ -21,8 +21,9 @@ public interface AppletLinkClickDao extends BaseDao<AppletLinkClick>{
* @author:zhuyajie
* @date:2020/5/12 10:44
* * @param null
* update: 增加参数intervalDaya(间隔天数) 2020/07/17 pansy
*/
Map<Long,PvuvDTO> mapPVUV(Integer typeId, Integer recordType, List<Long> fromIds);
Map<Long,PvuvDTO> mapPVUV(Integer typeId, Integer recordType, List<Long> fromIds,Integer intervalDaya);
/**
* 优惠券使用量
* @author:zhuyajie
......
......@@ -22,11 +22,12 @@ import java.util.Map;
public class AppletLinkClickDaoImpl extends BaseDaoImpl<AppletLinkClick> implements AppletLinkClickDao {
@Override
public Map<Long, PvuvDTO> mapPVUV(Integer typeId, Integer recordType, List<Long> fromIds) {
public Map<Long, PvuvDTO> mapPVUV(Integer typeId, Integer recordType, List<Long> fromIds,Integer intervalDaya) {
Map<String,Object> map = new HashMap<>();
map.put("list",fromIds);
map.put("recordType",recordType);
map.put("typeId",typeId);
map.put("intervalDaya",intervalDaya); //
return getSessionTemplate().selectMap(getStatement("mapPVUV"),map,"fromId");
}
......
......@@ -720,6 +720,9 @@ public class AppletHomeFacade {
@RequestParam(value = "gradeLabelId", required = false) @ApiParam("年级标签") Long gradeLabelId,
@RequestParam(value = "subjectLabelId", required = false) @ApiParam("科目标签") Long subjectLabelId,
@RequestParam(value = "linkOnly", required = false) @ApiParam("只看第三方") Integer linkOnly,
@RequestParam(value = "source", required = false) @ApiParam("来源") String source,
@RequestParam(value = "browseQty", required = false) @ApiParam("浏览量") Integer browseQty,
@RequestParam(value = "clickQty", required = false) @ApiParam("点击量") Integer clickQty,
@RequestParam(value = "rightsClassifyId", required = false) @ApiParam("权益分类") Long rightsClassifyId
) throws PermissionException {
SessionUtil.getInfoToken4Redis(token);
......@@ -727,7 +730,7 @@ public class AppletHomeFacade {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "缺少分页参数");
}
return new ResponseDto<>(appletNewsBiz.listAppletNews4Analysis(currentPage, numPerPage, name, firstClassify, secondClassify, gradeLabelId,
subjectLabelId, linkOnly,rightsClassifyId));
subjectLabelId, linkOnly,rightsClassifyId,source,browseQty,clickQty));
}
......
......@@ -40,5 +40,5 @@ public interface GiftCouponPackageBiz {
* @date:2020/5/11 19:29
* * @param null
*/
PageBeanNew<GiftPackageDTO> listGiftPackage4Analysis(String title, Integer state, Integer couponType, Integer currentPage, Integer numPerPage, Integer linkOnly);
PageBeanNew<GiftPackageDTO> listGiftPackage4Analysis(String title, Integer state, Integer couponType, Integer currentPage, Integer numPerPage, Integer linkOnly,Integer clickQty);
}
......@@ -212,7 +212,7 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
}
@Override
public PageBeanNew<GiftPackageDTO> listGiftPackage4Analysis(String title, Integer state, Integer couponType, Integer currentPage, Integer numPerPage, Integer linkOnly) {
public PageBeanNew<GiftPackageDTO> listGiftPackage4Analysis(String title, Integer state, Integer couponType, Integer currentPage, Integer numPerPage, Integer linkOnly,Integer clickQty) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("title", title);
paramMap.put("state", state);
......@@ -223,7 +223,7 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
return new PageBeanNew<>(currentPage, numPerPage, new ArrayList<>());
}
buildReceiveNum(pageBeanNew.getRecordList());
fillUseAnalysis(pageBeanNew.getRecordList());
fillUseAnalysis(pageBeanNew.getRecordList(),clickQty);
return pageBeanNew;
}
......@@ -233,12 +233,15 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
* @date:2020/5/11 19:43
* * @param null
*/
private void fillUseAnalysis(List<GiftPackageDTO> recordList) {
private void fillUseAnalysis(List<GiftPackageDTO> recordList,Integer clickQty) {
if (ListUtils.isEmpty(recordList)){
return;
}
if (null != clickQty && clickQty.intValue() >1){
clickQty += 1;
}
List<Long> ids = recordList.stream().filter(s -> s != null).map(GiftPackageDTO::getId).distinct().collect(Collectors.toList());
Map<Long, PvuvDTO> clickMap = appletLinkClickDao.mapPVUV(DataTypeEnum.gift_coupon.code, DataRecordTypeEnum.click.code, ids);
Map<Long, PvuvDTO> clickMap = appletLinkClickDao.mapPVUV(DataTypeEnum.gift_coupon.code, DataRecordTypeEnum.click.code, ids,clickQty);
Map<Long, PvuvDTO> useMap = appletLinkClickDao.mapCouponUseCount(ids);
for (GiftPackageDTO giftPackageDTO : recordList) {
Long id = giftPackageDTO.getId();
......
......@@ -162,10 +162,11 @@ public class GiftCouponPackageFacade {
@RequestParam(value = "couponType",required = false) @ApiParam("券类型") Integer couponType,
@RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage,
@RequestParam(value = "clickQty", required = false) @ApiParam("点击量") Integer clickQty,
@RequestParam(value = "linkOnly",required = false) @ApiParam("只看第三方") Integer linkOnly
) throws BizException, PermissionException {
SessionUtil.getInfoToken4Redis(token);
return new ResponseDto<>(giftCouponPackageBiz.listGiftPackage4Analysis(title, state, couponType, currentPage, numPerPage, linkOnly));
return new ResponseDto<>(giftCouponPackageBiz.listGiftPackage4Analysis(title, state, couponType, currentPage, numPerPage, linkOnly,clickQty));
}
}
......@@ -21,7 +21,8 @@
SELECT
from_id fromId,
COUNT(1) pv,
COUNT(DISTINCT wechat_user_id,create_date) uv
-- COUNT(DISTINCT wechat_user_id,create_date) uv
COUNT(DISTINCT wechat_user_id) uv
FROM applet_link_click
WHERE type_id = #{typeId}
AND record_type = #{recordType}
......@@ -29,6 +30,9 @@
<foreach collection="list" item="item" index="index" separator="," close=")" open="(">
#{item}
</foreach>
<if test="intervalDaya != null">
AND create_date between DATE_SUB(CURDATE(),INTERVAL #{intervalDaya} DAY) and DATE_SUB(CURDATE(),INTERVAL 1 DAY)
</if>
GROUP BY from_id
</select>
......
......@@ -403,6 +403,9 @@
<if test="rightsClassifyId!=null">
AND n.rights_classify_id =#{rightsClassifyId}
</if>
<if test="source!=null">
AND n.source =#{source}
</if>
ORDER BY n.create_time DESC
</select>
......
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