Commit f83fcd71 by gaopeng

1001111_广告位点击量统计,要算上没授权的

parent 9e6a5db0
......@@ -432,7 +432,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
String adTitle = advertisingSpace.getAdTitle();
List<String> linkList = getLinkList(adTitle);//提取文本链接
if (!ListUtils.isEmpty(linkList)) {
adTitle = adTitle.replaceAll("</link><link>","</link> <link>");//连续两个链接之间要有分隔
adTitle = adTitle.replaceAll("</link><link>", "</link> <link>");//连续两个链接之间要有分隔
for (String link : linkList) {
String adLink = "";
String adLinkOld = link.replaceAll("<link>", "").replace("</link>", "");
......@@ -633,9 +633,9 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) {
return new PageBean(0, 0, new ArrayList<>());
}
List<Object>objs = pageBean.getRecordList();
List<Object> objs = pageBean.getRecordList();
Object objectlist = (Object) objs;
List<GroupQrcodeVO> groupQrcodeVOList = ( List<GroupQrcodeVO>)objectlist;
List<GroupQrcodeVO> groupQrcodeVOList = (List<GroupQrcodeVO>) objectlist;
List<Long> labelIds = new ArrayList<>();
List<Long> proLabels = groupQrcodeVOList.stream().filter(s->s.getProLabelId()!=null).map(GroupQrcodeVO::getProLabelId).distinct().collect(Collectors.toList());
List<Long> depLabels = groupQrcodeVOList.stream().filter(s->s.getDepLabelId()!=null).map(GroupQrcodeVO::getDepLabelId).distinct().collect(Collectors.toList());
......@@ -643,16 +643,16 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
if (!ListUtils.isEmpty(proLabels)){
labelIds.addAll(proLabels);
}
if (!ListUtils.isEmpty(depLabels)){
if (!ListUtils.isEmpty(depLabels)) {
labelIds.addAll(depLabels);
}
if (!ListUtils.isEmpty(purLabels)){
if (!ListUtils.isEmpty(purLabels)) {
labelIds.addAll(purLabels);
}
if (!ListUtils.isEmpty(labelIds)) {
Map<Long, String> labelMap = labelConsr.getLabelName(labelIds);
if (!MapUtils.isEmpty(labelMap)) {
for (Object object:objs){
for (Object object : objs) {
GroupQrcodeVO qrcodeVO = (GroupQrcodeVO) object;
if (null != qrcodeVO.getProLabelId() && labelMap.containsKey(qrcodeVO.getProLabelId())) {
qrcodeVO.setProLabelName(labelMap.get(qrcodeVO.getProLabelId()));
......@@ -905,15 +905,16 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
}
/**
* 获取书刊广告位点击读者量
* 获取书刊广告位点击读者量(废弃,读者不走授权,读者信息全为空,没办法聚合,点击量就是读者量)
*/
private Long getClickUserNumByGroupQrcodeId(Long qrcodeId, Long adId, String statisMonth) {
Map<String, Object> paramMap = new HashMap<>();
/*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;
return null == clickUserNum ? 0L : clickUserNum;*/
return 0L;
}
/**
......@@ -1283,10 +1284,15 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
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()) {
Long wechatUserId = ((WechatGroupClickUserDTO) object).getWechatUserId();
wechatUserIds.add(wechatUserId);
}
Map<Long, WechatUser> wechatUserMap = new HashMap<>();
if (!ListUtils.isEmpty(wechatUserIds)) {
wechatUserIds = new ArrayList<>(new HashSet<>(wechatUserIds));
wechatUserMap = readerConsr.getUserList(wechatUserIds);
}
for (Object object : pageBean.getRecordList()) {
WechatGroupClickUserDTO dto = (WechatGroupClickUserDTO) object;
if (!MapUtils.isEmpty(wechatUserMap) && wechatUserMap.containsKey(dto.getWechatUserId())) {
......@@ -1318,8 +1324,12 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
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);
List<Long> wechatUserIds = list.stream().filter(dto -> null != dto.getWechatUserId()).map(WechatGroupClickUserDTO::getWechatUserId).collect(Collectors.toList());
Map<Long, WechatUser> wechatUserMap = new HashMap<>();
if (!ListUtils.isEmpty(wechatUserIds)) {
wechatUserIds = new ArrayList<>(new HashSet<>(wechatUserIds));
wechatUserMap = readerConsr.getUserList(wechatUserIds);
}
// 字段名
String[] rowsName = {"序号", "读者信息", "读者标签", "点击时间"};
List<Object[]> dataList = new ArrayList<>();
......@@ -1330,9 +1340,13 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
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();
objs[1] = null != wechatUser.getWechatUserNickname() ? wechatUser.getWechatUserNickname() : "--";
if (null == wechatUser.getWechatUserSex() && StringUtil.isEmpty(wechatUser.getWechatUserCity())) {
objs[2] = "--";
} else {
String sex = null == wechatUser.getWechatUserSex() ? "--" : (wechatUser.getWechatUserSex().equals(1) ? "男" : (wechatUser.getWechatUserSex().equals(2) ? "女" : "未知"));
objs[2] = sex + "," + (null == wechatUser.getWechatUserCity() ? "--" : wechatUser.getWechatUserCity());
}
} else {
objs[1] = "";
objs[2] = "";
......@@ -1343,10 +1357,10 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
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() + "广告位点击读者明细";
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() : "") + "点击读者明细";
fileName = space.getAdName() + "广告位" + (null != groupQrcode ? groupQrcode.getGroupName() : "") + "点击明细";
}
String fileUrl = exportConsr.exportExcel(fileName, rowsName, dataList);
Map<String, Object> result = new HashMap<>();
......
......@@ -371,7 +371,7 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade {
Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_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) {
if (null == advertisingClickRecord || null == advertisingClickRecord.getAdId()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!");
}
if ((null == advertisingClickRecord.getBookId() && !"WECHAT_GROUP".equals(advertisingClickRecord.getFromType()))
......
......@@ -122,7 +122,7 @@
from_type fromType,
from_id fromId,
wechat_user_id wechatUserId,
max(create_time) createTime
create_time createTime
FROM
advertising_click_record
WHERE
......@@ -132,9 +132,6 @@
<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>
......
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