Authored by zhengwen.ge

增加UV/PV

... ... @@ -25,6 +25,7 @@
<value>/ClickUnionRest/addCommonUnion</value>
<value>/ClickUnionRest/queryUnionClickLogs</value>
<value>/ClickUnionRest/queryUnionActivityLogs</value>
<value>/ClickUnionRest/queryPVandUV</value>
<value>/ClickUnionRest/addUnion4Special</value>
<value>/ClickUnionRest/addMonitor</value>
<value>/ActivateUnionRest/test</value>
... ...
package com.yoho.unions.dal;
import com.yoho.unions.dal.model.EventPv;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface EventPvMapper {
int deleteByPrimaryKey(Integer id);
int insert(EventPv record);
int insertSelective(EventPv record);
EventPv selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(EventPv record);
int updateByPrimaryKey(EventPv record);
List<EventPv> selectByChannelAndDate(@Param("beginDate")int beginDate,@Param("endDate")int endDate,@Param("channel")String channel);
}
\ No newline at end of file
... ...
package com.yoho.unions.dal;
import com.yoho.unions.dal.model.EventUv;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface EventUvMapper {
int deleteByPrimaryKey(Integer id);
int insert(EventUv record);
int insertSelective(EventUv record);
EventUv selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(EventUv record);
int updateByPrimaryKey(EventUv record);
List<EventUv> selectByChannelAndDate(@Param("beginDate")int beginDate,@Param("endDate")int endDate,@Param("channel")String channel);
}
\ No newline at end of file
... ...
package com.yoho.unions.dal.model;
public class EventPv {
private Integer id;
private String pv;
private String channel;
private String event;
private String createTime;
private Integer dateId;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getPv() {
return pv;
}
public void setPv(String pv) {
this.pv = pv == null ? null : pv.trim();
}
public String getChannel() {
return channel;
}
public void setChannel(String channel) {
this.channel = channel == null ? null : channel.trim();
}
public String getEvent() {
return event;
}
public void setEvent(String event) {
this.event = event == null ? null : event.trim();
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime == null ? null : createTime.trim();
}
public Integer getDateId() {
return dateId;
}
public void setDateId(Integer dateId) {
this.dateId = dateId;
}
}
\ No newline at end of file
... ...
package com.yoho.unions.dal.model;
public class EventUv {
private Integer id;
private String uv;
private String channel;
private String createTime;
private Integer dateId;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUv() {
return uv;
}
public void setUv(String uv) {
this.uv = uv == null ? null : uv.trim();
}
public String getChannel() {
return channel;
}
public void setChannel(String channel) {
this.channel = channel == null ? null : channel.trim();
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime == null ? null : createTime.trim();
}
public Integer getDateId() {
return dateId;
}
public void setDateId(Integer dateId) {
this.dateId = dateId;
}
}
\ No newline at end of file
... ...
... ... @@ -15,7 +15,7 @@
</sql>
<select id="selectByUdid" resultMap="BaseResultMap">
select <include refid="Blob_Column_List"/>
select UID
from BASE_UDID_RELATION where udid =#{udid} limit 1
</select>
</mapper>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.unions.dal.EventPvMapper" >
<resultMap id="BaseResultMap" type="com.yoho.unions.dal.model.EventPv" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="PV" property="pv" jdbcType="VARCHAR" />
<result column="CHANNEL" property="channel" jdbcType="VARCHAR" />
<result column="EVENT" property="event" jdbcType="VARCHAR" />
<result column="CREATE_TIME" property="createTime" jdbcType="VARCHAR" />
<result column="DATE_ID" property="dateId" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
id, PV, CHANNEL, EVENT, CREATE_TIME, DATE_ID
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from EVENT_PV
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from EVENT_PV
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.yoho.unions.dal.model.EventPv" >
insert into EVENT_PV (id, PV, CHANNEL,
EVENT, CREATE_TIME, DATE_ID
)
values (#{id,jdbcType=INTEGER}, #{pv,jdbcType=VARCHAR}, #{channel,jdbcType=VARCHAR},
#{event,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR}, #{dateId,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.yoho.unions.dal.model.EventPv" >
insert into EVENT_PV
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="pv != null" >
PV,
</if>
<if test="channel != null" >
CHANNEL,
</if>
<if test="event != null" >
EVENT,
</if>
<if test="createTime != null" >
CREATE_TIME,
</if>
<if test="dateId != null" >
DATE_ID,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="pv != null" >
#{pv,jdbcType=VARCHAR},
</if>
<if test="channel != null" >
#{channel,jdbcType=VARCHAR},
</if>
<if test="event != null" >
#{event,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=VARCHAR},
</if>
<if test="dateId != null" >
#{dateId,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.unions.dal.model.EventPv" >
update EVENT_PV
<set >
<if test="pv != null" >
PV = #{pv,jdbcType=VARCHAR},
</if>
<if test="channel != null" >
CHANNEL = #{channel,jdbcType=VARCHAR},
</if>
<if test="event != null" >
EVENT = #{event,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
CREATE_TIME = #{createTime,jdbcType=VARCHAR},
</if>
<if test="dateId != null" >
DATE_ID = #{dateId,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.yoho.unions.dal.model.EventPv" >
update EVENT_PV
set PV = #{pv,jdbcType=VARCHAR},
CHANNEL = #{channel,jdbcType=VARCHAR},
EVENT = #{event,jdbcType=VARCHAR},
CREATE_TIME = #{createTime,jdbcType=VARCHAR},
DATE_ID = #{dateId,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectByChannelAndDate" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from EVENT_PV where 1=1 and DATE_ID BETWEEN #{beginDate} and #{endDate} <if test="channel != null and channel !=''">
and CHANNEL = #{channel}
</if>
</select>
</mapper>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.unions.dal.EventUvMapper" >
<resultMap id="BaseResultMap" type="com.yoho.unions.dal.model.EventUv" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="UV" property="uv" jdbcType="VARCHAR" />
<result column="CHANNEL" property="channel" jdbcType="VARCHAR" />
<result column="CREATE_TIME" property="createTime" jdbcType="VARCHAR" />
<result column="DATE_ID" property="dateId" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
id, UV, CHANNEL, CREATE_TIME, DATE_ID
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from EVENT_UV
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from EVENT_UV
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.yoho.unions.dal.model.EventUv" >
insert into EVENT_UV (id, UV, CHANNEL,
CREATE_TIME, DATE_ID)
values (#{id,jdbcType=INTEGER}, #{uv,jdbcType=VARCHAR}, #{channel,jdbcType=VARCHAR},
#{createTime,jdbcType=VARCHAR}, #{dateId,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.yoho.unions.dal.model.EventUv" >
insert into EVENT_UV
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="uv != null" >
UV,
</if>
<if test="channel != null" >
CHANNEL,
</if>
<if test="createTime != null" >
CREATE_TIME,
</if>
<if test="dateId != null" >
DATE_ID,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="uv != null" >
#{uv,jdbcType=VARCHAR},
</if>
<if test="channel != null" >
#{channel,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=VARCHAR},
</if>
<if test="dateId != null" >
#{dateId,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.unions.dal.model.EventUv" >
update EVENT_UV
<set >
<if test="uv != null" >
UV = #{uv,jdbcType=VARCHAR},
</if>
<if test="channel != null" >
CHANNEL = #{channel,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
CREATE_TIME = #{createTime,jdbcType=VARCHAR},
</if>
<if test="dateId != null" >
DATE_ID = #{dateId,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.yoho.unions.dal.model.EventUv" >
update EVENT_UV
set UV = #{uv,jdbcType=VARCHAR},
CHANNEL = #{channel,jdbcType=VARCHAR},
CREATE_TIME = #{createTime,jdbcType=VARCHAR},
DATE_ID = #{dateId,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectByChannelAndDate" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from EVENT_UV where 1=1 and DATE_ID BETWEEN #{beginDate} and #{endDate} <if test="channel != null and channel!=''">
and CHANNEL = #{channel}
</if>
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -503,4 +503,19 @@ public class ClickUnionRest {
}
}
@RequestMapping("/queryPVandUV")
@ResponseBody
public ApiResponse queryPVandUV(UnionLogsReqBO unionLogsReqBO){
log.info("enter queryPVandUV. param unionLogsReqBO={}", unionLogsReqBO);
if(unionLogsReqBO ==null){
return new ApiResponse.ApiResponseBuilder().code(500).message("缺少参数").build();
}
try{
PageUnionActivityLogsRspBO pageUnionActivityLogsRspBO = unionService.queryUnionPVandUV(unionLogsReqBO);
return new ApiResponse.ApiResponseBuilder().code(200).message("成功").data(pageUnionActivityLogsRspBO ).build();
}catch (Exception e){
return new ApiResponse.ApiResponseBuilder().code(500).message("失败").build();
}
}
}
... ...
... ... @@ -78,6 +78,8 @@ public interface IUnionService {
PageUnionActivityLogsRspBO queryUnionActivityLogs(UnionLogsReqBO unionLogsReqBO);
PageUnionActivityLogsRspBO queryUnionPVandUV(UnionLogsReqBO unionLogsReqBO);
PageActivateDeviceIdRspBO queryActivateHour(ActivateDeviceIdReqBO activateDeviceIdReqBO);
PageActivateDeviceIdRspBO queryActivateDay(ActivateDeviceIdReqBO activateDeviceIdReqBO);
... ...
... ... @@ -127,6 +127,12 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
@Resource
BaseUserActiveDayMapper baseUserActiveDayMapper;
@Resource
EventPvMapper eventPvMapper;
@Resource
EventUvMapper eventUvMapper;
@Resource(name="unionServiceImpl")
IUnionService unionService;
... ... @@ -1049,4 +1055,44 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
rspBO.setList(anaBOList);
return rspBO;
}
@Override
public PageUnionActivityLogsRspBO queryUnionPVandUV(UnionLogsReqBO unionLogsReqBO){
String interfaceType = unionLogsReqBO.getInterfaceType();
long activateTimeBegin = unionLogsReqBO.getCreateTimeBegin();
long activateTimeEnd = unionLogsReqBO.getCreateTimeEnd();
//转成dateid
String beginDate = DateUtil.long2DateStr(activateTimeBegin*1000,"yyyyMMdd");
String endDate = DateUtil.long2DateStr(activateTimeEnd*1000,"yyyyMMdd");
//
String pvType = unionLogsReqBO.getPvType();
PageUnionActivityLogsRspBO pageUnionActivityLogsRspBO = new PageUnionActivityLogsRspBO();
List<UnionActivityLogsRspBO> unionActivityLogsRspBOList = new ArrayList<>();
if(pvType.equals("pv")){
List<EventPv> eventPvList = eventPvMapper.selectByChannelAndDate(Integer.valueOf(beginDate),Integer.valueOf(endDate),interfaceType);
for(EventPv eventPv:eventPvList){
UnionActivityLogsRspBO unionActivityLogsRspBO = new UnionActivityLogsRspBO();
unionActivityLogsRspBO.setChannelId(eventPv.getChannel());
unionActivityLogsRspBO.setPvCount(eventPv.getPv());
unionActivityLogsRspBO.setDateId(String.valueOf(eventPv.getDateId()));
unionActivityLogsRspBO.setEvent(eventPv.getEvent());
unionActivityLogsRspBOList.add(unionActivityLogsRspBO);
}
}else{
List<EventUv> eventUvList = eventUvMapper.selectByChannelAndDate(Integer.valueOf(beginDate), Integer.valueOf(endDate), interfaceType);
for(EventUv eventUv:eventUvList){
UnionActivityLogsRspBO unionActivityLogsRspBO = new UnionActivityLogsRspBO();
unionActivityLogsRspBO.setChannelId(eventUv.getChannel());
unionActivityLogsRspBO.setDateId(String.valueOf(eventUv.getDateId()));
unionActivityLogsRspBO.setUvCount(eventUv.getUv());
unionActivityLogsRspBOList.add(unionActivityLogsRspBO);
}
}
pageUnionActivityLogsRspBO.setList(unionActivityLogsRspBOList);
return pageUnionActivityLogsRspBO;
}
}
... ...
... ... @@ -74,6 +74,8 @@ datasources:
- com.yoho.unions.dal.BaseOrderShipmentUdidMapper
- com.yoho.unions.dal.IAppActiveDAO
- com.yoho.unions.dal.AppChannelActiveMapper
- com.yoho.unions.dal.EventPvMapper
- com.yoho.unions.dal.EventUvMapper
erp_orders:
servers:
... ...
... ... @@ -72,6 +72,9 @@ datasources:
- com.yoho.unions.dal.BaseOrderShipmentUdidMapper
- com.yoho.unions.dal.IAppActiveDAO
- com.yoho.unions.dal.AppChannelActiveMapper
- com.yoho.unions.dal.EventPvMapper
- com.yoho.unions.dal.EventUvMapper
bigdata_yoho_passport:
servers:
... ...
... ... @@ -183,56 +183,72 @@
</form>
</div>
</div>
<div title="PV/UV查询" style="padding:20px;display:none;overflow:auto;">
<div id="searchPvUv" region="north" style="padding-bottom: 35px; ">
<!--<script>-->
<!--document.write(addHead('市场管理', '分组营销管理'));-->
<!--</script>-->
<style>
.div_search input {
margin-top: 20px;
}
<div region="center">
<div style="margin-left: 30px;margin-top: 20px; height:500px;">
<table id="openTable"></table>
</div>
</div>
</div>
.div_search .textbox {
margin-top: 20px;
}
<div title="PV/UV查询" style="padding:20px;display:none;overflow:auto;">
<div id="searchPvUv" region="north" style="padding-bottom: 35px; ">
<!--<script>-->
<!--document.write(addHead('市场管理', '分组营销管理'));-->
<!--</script>-->
<style>
.div_search input {
margin-top: 20px;
}
.div_search .easyui-linkbutton {
margin-top: 20px;
}
.div_search .textbox {
margin-top: 20px;
}
.subtotal {
font-weight: bold;
}
/*合计单元格样式*/
</style>
<div style="margin-left: 30px;" class="div_search">
<form id="clickPVForm" method="post" accept-charset="utf-8">
<input name="interfaceType" class="easyui-combobox" data-options="
.div_search .easyui-linkbutton {
margin-top: 20px;
}
.subtotal {
font-weight: bold;
}
/*合计单元格样式*/
</style>
<div style="margin-left: 30px;" class="div_search">
<form id="clickPVForm" method="post" accept-charset="utf-8">
<input name="interfaceType" class="easyui-combobox" data-options="
valueField: 'id',
editable: false,
textField: 'text',
width:200,
prompt:'选择泛点击接口',
prompt:'选择渠道来源',
data: [
{ id: '', text: '全部' },
{ id: 'gdt', text: '广点通' },
{ id: 'pinyou', text: '品友' },
{ id: '广点通', text: '广点通' },
{ id: '品友', text: '品友' },
{ id: 'criteo', text: 'criteo' }
]"/>
<input name="createTimeBegin" id='clickPVTimeBegin' class="easyui-datetimebox" data-options="editable: false,prompt:'开始时间'" style="width: 200px;">
<input name="createTimeEnd" id='clickPVTimeEnd' class="easyui-datetimebox" editable="false"
data-options="prompt:'结束时间'" style="width: 200px;">
<a id="clickPVBtn" class="easyui-linkbutton btn-info" style="margin-left: 30px; "></a>
</form>
</div>
<input name="pvType" class="easyui-combobox" data-options="
valueField: 'id',
editable: false,
textField: 'text',
width:200,
prompt:'UV',
data: [
{ id: 'pv', text: 'PV' },
{ id: 'uv', text: 'UV' }
]"/>
<input name="createTimeBegin" id='clickPVTimeBegin' class="easyui-datetimebox" data-options="editable: false,prompt:'开始时间'" style="width: 200px;">
<input name="createTimeEnd" id='clickPVTimeEnd' class="easyui-datetimebox" editable="false"
data-options="prompt:'结束时间'" style="width: 200px;">
<a id="clickPVBtn" class="easyui-linkbutton btn-info" style="margin-left: 30px; "></a>
</form>
</div>
</div>
<div region="center">
<div style="margin-left: 30px;margin-top: 20px; height:500px;">
<table id="openTable"></table>
</div>
<div region="center">
<div style="margin-left: 30px;margin-top: 20px; height:500px;">
<table id="openPV"></table>
</div>
</div>
</div>
... ... @@ -251,6 +267,8 @@
$('#openTimeBegin').datetimebox('setValue', currentDateBegin);
$('#openTimeEnd').datetimebox('setValue', currentDateEnd);
$('#clickPVTimeBegin').datetimebox('setValue',currentDateBegin);
$('#clickPVTimeEnd').datetimebox('setValue',currentDateEnd);
$("#activateTalbe").myDatagrid({
fit: true,
fitColumns: true,
... ... @@ -619,6 +637,8 @@
checkOnSelect: false
});
$("#openTable").myDatagrid({
fit: true,
fitColumns: true,
... ... @@ -671,6 +691,54 @@
checkOnSelect: false
});
$("#openPV").myDatagrid({
fit: true,
fitColumns: true,
nowrap: false,
url: '',
method: 'POST',
queryParams: getParam("clickPVForm"),
loadFilter: function (data) {
var temp = defaultLoadFilter(data);
temp.rows = temp.list;
return temp;
},
columns: [[{
title: "渠道名称",
field: "channelId",
width: 120,
align: "center"
}, {
title: "事件",
field: "event",
width: 230,
align: "center",
}, {
title: "UV",
field: "uvCount",
width: 180,
align: "center",
}, {
title: "PV",
field: "pvCount",
width: 120,
align: "center",
},{
title: "日期",
field: "dateId",
width: 140,
align: "center"
}
]],
cache: false,
pagination: false,
pageSize: 10,
pageList: [10],
idField: "id",
singleSelect: false,
checkOnSelect: false
});
function getParam(table) {
var paramsArray = $("#"+table+"").serializeArray();
var params = {};
... ... @@ -758,6 +826,21 @@
}
});
$("#clickPVBtn").linkbutton({
iconCls: "icon-search",
text: "查询",
onClick: function () {
$("#openPV").datagrid(
{
url: contextPath + "/ClickUnionRest/queryPVandUV",
queryParams: getParam("clickPVForm")
});
}
});
$("#idfaImportDiv").fileUpload({
text: "请选择idfa导入匹配", //按钮文字
uploadInputName: "file", //上传文件的控件名称
... ...