Authored by linlong

update

... ... @@ -20,6 +20,8 @@
<value>/ActivateUnionRest/activateUnion</value>
<value>/ClickUnionRest/addUnion</value>
<value>/ClickUnionRest/addCommonUnion</value>
<value>/ClickUnionRest/queryUnionClickLogs</value>
<value>/ClickUnionRest/queryUnionActivityLogs</value>
<value>/ClickUnionRest/addUnion4Special</value>
<value>/ClickUnionRest/addMonitor</value>
<value>/ActivateUnionRest/test</value>
... ...
package com.yoho.unions.dal;
import com.yoho.service.model.union.request.UnionLogsReqBO;
import com.yoho.unions.dal.model.UnionActivityLogs;
import org.apache.ibatis.annotations.Param;
... ... @@ -20,4 +21,8 @@ public interface IUnionActivityLogsDAO {
int updateByPrimaryKey(UnionActivityLogs record);
List<UnionActivityLogs> selectByTime(@Param("beginTime")int beginTime,@Param("endTime")int endTime);
List<UnionActivityLogs> queryUnionActivityLogsByParam(UnionLogsReqBO unionLogsReqBO);
int queryUnionActivityLogsCountByParam(UnionLogsReqBO unionLogsReqBO);
}
\ No newline at end of file
... ...
... ... @@ -2,6 +2,7 @@ package com.yoho.unions.dal;
import com.yoho.service.model.union.request.ActivateDeviceIdReqBO;
import com.yoho.service.model.union.request.UnionLogsReqBO;
import com.yoho.service.model.union.response.ActivateDeviceIdRspBO;
import com.yoho.unions.dal.model.UnionClickLogs;
import org.apache.ibatis.annotations.Param;
... ... @@ -30,4 +31,8 @@ public interface IUnionClickLogsDAO {
Integer queryActivateIdfaCount(ActivateDeviceIdReqBO activateDeviceIdReqBO);
Integer queryActivateImeiCount(ActivateDeviceIdReqBO activateDeviceIdReqBO);
int queryUnionClickLogsCountByParam(UnionLogsReqBO unionLogsReqBO);
List<UnionClickLogs> queryUnionClickLogsByParam(UnionLogsReqBO unionLogsReqBO);
}
\ No newline at end of file
... ...
... ... @@ -177,4 +177,46 @@
<include refid="Base_Column_List" />
from union_activity_logs where create_time &gt; #{beginTime} and create_time &lt;#{endTime} and app_key = 'yohobuy'
</select>
<select id="queryUnionActivityLogsCountByParam" resultType="java.lang.Integer"
parameterType="com.yoho.service.model.union.request.UnionLogsReqBO">
select count(1)
from union_activity_logs where 1=1
<if test="createTimeBegin != null and createTimeBegin>0">
and create_time>=#{createTimeBegin,jdbcType=INTEGER}
</if>
<if test="createTimeEnd != null and createTimeEnd>0">
and create_time &lt;= #{createTimeEnd,jdbcType=INTEGER}
</if>
<if test="unionType !=null and unionType !='' ">
and union_type = #{unionType}
</if>
<if test="idfa !=null and idfa !='' ">
and idfa = #{idfa}
</if>
<if test="imei !=null and imei !='' ">
and imei = #{imei}
</if>
</select>
<select id="queryUnionActivityLogsByParam" resultMap="BaseResultMap"
parameterType="com.yoho.service.model.union.request.UnionLogsReqBO">
select <include refid="Base_Column_List"/>
from union_activity_logs
where 1=1
<if test="createTimeBegin != null and createTimeBegin>0">
and create_time>=#{createTimeBegin,jdbcType=INTEGER}
</if>
<if test="createTimeEnd != null and createTimeEnd>0">
and create_time &lt;= #{createTimeEnd,jdbcType=INTEGER}
</if>
<if test="unionType !=null and unionType !='' ">
and union_type = #{unionType}
</if>
<if test="idfa !=null and idfa !='' ">
and idfa = #{idfa}
</if>
<if test="imei !=null and imei !='' ">
and imei = #{imei}
</if>
ORDER BY create_time DESC limit #{start,jdbcType=INTEGER}, #{size,jdbcType=INTEGER}
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -198,4 +198,52 @@
</if>
group by union_type
</select>
<select id="queryUnionClickLogsByParam" resultMap="BaseResultMap"
parameterType="com.yoho.service.model.union.request.UnionLogsReqBO">
select <include refid="Base_Column_List"/>
from union_click_logs
where 1=1
<if test="interfaceType != null and interfaceType !='' ">
and interface_type=#{interfaceType}
</if>
<if test="createTimeBegin != null and createTimeBegin>0">
and create_time>=#{createTimeBegin,jdbcType=INTEGER}
</if>
<if test="createTimeEnd != null and createTimeEnd>0">
and create_time &lt;= #{createTimeEnd,jdbcType=INTEGER}
</if>
<if test="unionType !=null and unionType !='' ">
and union_type = #{unionType}
</if>
<if test="idfa !=null and idfa !='' ">
and idfa = #{idfa}
</if>
<if test="imei !=null and imei !='' ">
and imei = #{imei}
</if>
ORDER BY create_time DESC limit #{start,jdbcType=INTEGER}, #{size,jdbcType=INTEGER}
</select>
<select id="queryUnionClickLogsCountByParam" resultType="java.lang.Integer"
parameterType="com.yoho.service.model.union.request.UnionLogsReqBO">
select count(1)
from union_click_logs where 1=1
<if test="interfaceType != null and interfaceType !='' ">
and interface_type=#{interfaceType}
</if>
<if test="createTimeBegin != null and createTimeBegin>0">
and create_time>=#{createTimeBegin,jdbcType=INTEGER}
</if>
<if test="createTimeEnd != null and createTimeEnd>0">
and create_time &lt;= #{createTimeEnd,jdbcType=INTEGER}
</if>
<if test="unionType !=null and unionType !='' ">
and union_type = #{unionType}
</if>
<if test="idfa !=null and idfa !='' ">
and idfa = #{idfa}
</if>
<if test="imei !=null and imei !='' ">
and imei = #{imei}
</if>
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yoho.service.model.union.request.ActivateDeviceIdReqBO;
import com.yoho.service.model.union.request.ClickUnionRequestBO;
import com.yoho.service.model.union.request.UnionLogsReqBO;
import com.yoho.service.model.union.response.PageUnionActivityLogsRspBO;
import com.yoho.service.model.union.response.PageUnionClickLogsRspBO;
import com.yoho.service.model.union.response.UnionResponse;
import com.yoho.unions.common.ApiResponse;
... ... @@ -478,4 +479,20 @@ public class ClickUnionRest {
}
}
@RequestMapping("/queryUnionActivityLogs")
@ResponseBody
public ApiResponse queryUnionActivityLogs(UnionLogsReqBO unionLogsReqBO){
log.info("enter queryUnionActivityLogs. param unionLogsReqBO={}", unionLogsReqBO);
if(unionLogsReqBO==null){
return new ApiResponse.ApiResponseBuilder().code(500).message("缺少参数").build();
}
try {
PageUnionActivityLogsRspBO pageUnionActivityLogsRspBO = unionService.queryUnionActivityLogs(unionLogsReqBO);
return new ApiResponse.ApiResponseBuilder().code(200).message("成功").data(pageUnionActivityLogsRspBO ).build();
} catch (Exception e) {
log.warn("queryActivateDeviceId occurs Exception e {}",e.getMessage());
return new ApiResponse.ApiResponseBuilder().code(500).message("失败").build();
}
}
}
... ...
... ... @@ -77,4 +77,6 @@ public interface IUnionService {
PageActivateDeviceIdResponseBO queryByDeviceId(ActivateDeviceIdReqBO activateDeviceIdReqBO);
PageUnionClickLogsRspBO queryUnionClickLogs(UnionLogsReqBO unionLogsReqBO);
PageUnionActivityLogsRspBO queryUnionActivityLogs(UnionLogsReqBO unionLogsReqBO);
}
... ...
... ... @@ -10,6 +10,7 @@ import com.google.common.collect.Lists;
import com.netflix.config.DynamicIntProperty;
import com.netflix.config.DynamicPropertyFactory;
import com.yoho.core.common.utils.MD5;
import com.yoho.core.common.utils.Marker;
import com.yoho.core.redis.YHRedisTemplate;
import com.yoho.core.redis.YHValueOperations;
import com.yoho.core.rest.client.ServiceCaller;
... ... @@ -649,11 +650,16 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
@Override
public PageActivateDeviceIdResponseBO queryByDeviceId(ActivateDeviceIdReqBO activateDeviceIdReqBO) {
log.info("enter queryByDeviceId. param activateDeviceIdReqBO={}", activateDeviceIdReqBO);
activateDeviceIdReqBO.setIdfa(activateDeviceIdReqBO.getIdfa().trim());
activateDeviceIdReqBO.setImei(activateDeviceIdReqBO.getImei().trim());
if(StringUtils.isNotEmpty(activateDeviceIdReqBO.getIdfa())){
activateDeviceIdReqBO.setImei(null);
activateDeviceIdReqBO.setIdfa(activateDeviceIdReqBO.getIdfa().trim());
} else{
if (StringUtils.isNotEmpty(activateDeviceIdReqBO.getImei())){
activateDeviceIdReqBO.setImei(activateDeviceIdReqBO.getImei().trim());
}
}
List<UnionLogs> unionLogs = unionLogsDAO.queryByDeviceId(activateDeviceIdReqBO);
List<ActivateDeviceIdResponseBO> activateDeviceIdResponseBOList =Lists.transform(unionLogs,input -> {
ActivateDeviceIdResponseBO output = new ActivateDeviceIdResponseBO();
... ... @@ -762,11 +768,61 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
if (StringUtils.isNotEmpty(unionLogsReqBO.getIdfa())) {
unionLogsReqBO.setImei(null);
unionLogsReqBO.setIdfa(unionLogsReqBO.getIdfa().trim());
} else {
unionLogsReqBO.setImei(unionLogsReqBO.getImei().trim());
} else{
if (StringUtils.isNotEmpty(unionLogsReqBO.getImei())){
unionLogsReqBO.setImei(unionLogsReqBO.getImei().trim());
}
}
// int total = unionCLogsDAO.(activateDeviceIdReqBO);
int total = unionClickLogsDAO.queryUnionClickLogsCountByParam(unionLogsReqBO);
List<UnionClickLogs> unionClickLogsList = Lists.newArrayList();
if(total>0){
unionClickLogsList = unionClickLogsDAO.queryUnionClickLogsByParam(unionLogsReqBO);
}
List<UnionClickLogsRspBO> list = Lists.transform(unionClickLogsList, input -> {
UnionClickLogsRspBO output = new UnionClickLogsRspBO();
BeanUtils.copyProperties(input, output);
return output;
});
return null;
PageUnionClickLogsRspBO page = new PageUnionClickLogsRspBO();
page.setPage(unionLogsReqBO.getPage());
page.setTotal(total);
page.setList(list);
return page;
}
@Override
public PageUnionActivityLogsRspBO queryUnionActivityLogs(UnionLogsReqBO unionLogsReqBO) {
log.info("enter queryUnionActivityLogs. param unionLogsReqBO={}", unionLogsReqBO);
if (StringUtils.isNotEmpty(unionLogsReqBO.getIdfa())) {
unionLogsReqBO.setImei(null);
unionLogsReqBO.setIdfa(unionLogsReqBO.getIdfa().trim());
} else{
if (StringUtils.isNotEmpty(unionLogsReqBO.getImei())){
unionLogsReqBO.setImei(unionLogsReqBO.getImei().trim());
}
}
int total = unionActivityLogsDAO.queryUnionActivityLogsCountByParam(unionLogsReqBO);
List<UnionActivityLogs> unionActivityLogsList = Lists.newArrayList();
if(total>0){
unionActivityLogsList = unionActivityLogsDAO.queryUnionActivityLogsByParam(unionLogsReqBO);
}
List<UnionActivityLogsRspBO> list = Lists.transform(unionActivityLogsList, input -> {
UnionActivityLogsRspBO output = new UnionActivityLogsRspBO();
BeanUtils.copyProperties(input, output);
return output;
});
PageUnionActivityLogsRspBO page = new PageUnionActivityLogsRspBO();
page.setPage(unionLogsReqBO.getPage());
page.setTotal(total);
page.setList(list);
return page;
}
}
... ...
... ... @@ -63,7 +63,7 @@
</div>
</div>
</div>
<div title="激活点击查询" data-options="closable:true" style="overflow:auto;padding:20px;display:none;">
<div title="激活查询" data-options="closable:true" style="overflow:auto;padding:20px;display:none;">
<div id="search2" region="north" style="padding-bottom: 35px; ">
<form id="searchForm2" method="post" accept-charset="utf-8">
<input name="idfa" type="text" class="easyui-textbox" data-options="prompt:'请输入idfa'"
... ... @@ -82,6 +82,111 @@
<div id="matchDiv" style="padding:30px;height:420px;"></div>
</div>
</div>
<div title="点击查询" style="padding:20px;display:none;overflow:auto;">
<div id="searchClick" region="north" style="padding-bottom: 35px; ">
<!--<script>-->
<!--document.write(addHead('市场管理', '分组营销管理'));-->
<!--</script>-->
<style>
.div_search input {
margin-top: 20px;
}
.div_search .textbox {
margin-top: 20px;
}
.div_search .easyui-linkbutton {
margin-top: 20px;
}
.subtotal {
font-weight: bold;
}
/*合计单元格样式*/
</style>
<div style="margin-left: 30px;" class="div_search">
<form id="clickForm" method="post" accept-charset="utf-8">
<input name="interfaceType" class="easyui-combobox" data-options="
valueField: 'id',
editable: false,
textField: 'text',
width:200,
prompt:'选择泛点击接口',
data: [
{ id: '', text: '全部' },
{ id: 'addUnion_ios', text: 'addUnion_ios' },
{ id: 'addUnion_android', text: 'addUnion_android' },
{ id: 'addUnion4Jump_ios', text: 'addUnion4Jump_ios' },
{ id: 'addUnion4Jump_android', text: 'addUnion4Jump_android' },
{ id: 'addMonitor_ios', text: 'addMonitor_ios' },
{ id: 'addMonitor_android', text: 'addMonitor_android' }
]"/>
<input name="unionType" type="text" class="easyui-textbox" data-options="prompt:'请输入渠道号'"
style="width: 200px;">
<input name="idfa" type="text" class="easyui-textbox" data-options="prompt:'请输入idfa'"
style="width: 200px;">
<input name="imei" type="text" class="easyui-textbox" data-options="prompt:'请输入imei'"
style="width: 200px;">
<input name="createTimeBegin" class="easyui-datetimebox" data-options="editable: false,showSeconds:false,prompt:'点击开始时间'" style="width: 200px;">
<input name="createTimeEnd" class="easyui-datetimebox" editable="false"
data-options="prompt:'点击结束时间'" style="width: 200px;">
<a id="clickBtn" 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="clickTable"></table>
</div>
</div>
</div>
<div title="打开查询" style="padding:20px;display:none;overflow:auto;">
<div id="searchOpen" region="north" style="padding-bottom: 35px; ">
<!--<script>-->
<!--document.write(addHead('市场管理', '分组营销管理'));-->
<!--</script>-->
<style>
.div_search input {
margin-top: 20px;
}
.div_search .textbox {
margin-top: 20px;
}
.div_search .easyui-linkbutton {
margin-top: 20px;
}
.subtotal {
font-weight: bold;
}
/*合计单元格样式*/
</style>
<div style="margin-left: 30px;" class="div_search">
<form id="openForm" method="post" accept-charset="utf-8">
<input name="unionType" type="text" class="easyui-textbox" data-options="prompt:'请输入渠道号'"
style="width: 200px;">
<input name="idfa" type="text" class="easyui-textbox" data-options="prompt:'请输入idfa'"
style="width: 200px;">
<input name="imei" type="text" class="easyui-textbox" data-options="prompt:'请输入imei'"
style="width: 200px;">
<input name="createTimeBegin" class="easyui-datetimebox" data-options="editable: false,showSeconds:false,prompt:'打开开始时间'" style="width: 200px;">
<input name="createTimeEnd" class="easyui-datetimebox" editable="false"
data-options="prompt:'打开结束时间'" style="width: 200px;">
<a id="openBtn" 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>
</div>
</div>
... ... @@ -98,7 +203,7 @@
url: '',
// url: contextPath + "/ActivateUnionRest/queryActivateDeviceId",
method: 'POST',
queryParams: getParams(),
queryParams:getParam("searchForm"),
loadFilter: function (data) {
var temp = defaultLoadFilter(data);
temp.rows = temp.list;
... ... @@ -157,7 +262,7 @@
onClick: function () {
// showIdfaClick($(this).attr("dataId"));
var p = $(this).parent();
var params = getParams();
var params = getParam("searchForm");
params['unionType'] = $(this).attr("dataId");
params['isIdfa'] = 1;
$.post(contextPath + "/ActivateUnionRest/queryActivateCount", params, function (data) {
... ... @@ -175,7 +280,7 @@
onClick: function () {
// showImeiClick($(this).attr("dataId"));
var p = $(this).parent();
var params = getParams();
var params = getParam("searchForm");
params['unionType'] = $(this).attr("dataId");
params['isIdfa'] = 0;
$.post(contextPath + "/ActivateUnionRest/queryActivateCount", params, function (data) {
... ... @@ -214,7 +319,7 @@
nowrap: false,
url: '',
method: 'POST',
queryParams: getParams2(),
queryParams: getParam("searchForm2"),
loadFilter: function (data) {
var temp = defaultLoadFilter(data);
temp.rows = temp.list;
... ... @@ -245,8 +350,7 @@
field: "createTime",
width: 180,
align: "center"
}
, {
}, {
title: "激活接口",
field: "interfaceType",
width: 180,
... ... @@ -261,17 +365,143 @@
checkOnSelect: false
});
function getParams() {
var paramsArray = $("#searchForm").serializeArray();
var params = {};
for (var i = 0; i < paramsArray.length; i++) {
params[paramsArray[i].name] = paramsArray[i].value;
$("#clickTable").myDatagrid({
fit: true,
fitColumns: true,
nowrap: false,
url: '',
method: 'POST',
queryParams: getParam("clickForm"),
loadFilter: function (data) {
var temp = defaultLoadFilter(data);
temp.rows = temp.list;
return temp;
},
columns: [[{
title: "渠道Id",
field: "unionType",
width: 120,
align: "center"
}, {
title: "渠道名称",
field: "unionName",
width: 120,
align: "center"
}, {
title: "idfa",
field: "idfa",
width: 230,
align: "center"
}, {
title: "imei",
field: "imei",
width: 180,
align: "center"
}, {
title: "激活时间",
field: "createTime",
width: 120,
align: "center"
},{
title: "激活接口",
field: "interfaceType",
width: 140,
align: "center"
},{
title: "客户端类型",
field: "clientType",
width: 120,
align: "center"
},{
title: "td",
field: "td",
width: 180,
align: "center"
},{
title: "ip",
field: "clientIp",
width: 120,
align: "center"
},{
title: "ua",
field: "userAgent",
width: 250,
align: "center"
}
return params;
}
]],
cache: false,
pagination: true,
pageSize: 10,
pageList: [10],
idField: "id",
singleSelect: false,
checkOnSelect: false
});
function getParams2() {
var paramsArray = $("#searchForm2").serializeArray();
$("#openTable").myDatagrid({
fit: true,
fitColumns: true,
nowrap: false,
url: '',
method: 'POST',
queryParams: getParam("openForm"),
loadFilter: function (data) {
var temp = defaultLoadFilter(data);
temp.rows = temp.list;
return temp;
},
columns: [[{
title: "渠道Id",
field: "unionType",
width: 120,
align: "center"
}, {
title: "渠道名称",
field: "unionName",
width: 120,
align: "center"
}, {
title: "idfa",
field: "idfa",
width: 230,
align: "center"
}, {
title: "imei",
field: "imei",
width: 180,
align: "center"
}, {
title: "打开时间",
field: "createTime",
width: 120,
align: "center"
},{
title: "客户端类型",
field: "clientType",
width: 120,
align: "center"
},{
title: "td",
field: "td",
width: 180,
align: "center"
},{
title: "ip",
field: "clientIp",
width: 120,
align: "center"
}]],
cache: false,
pagination: true,
pageSize: 10,
pageList: [10],
idField: "id",
singleSelect: false,
checkOnSelect: false
});
function getParam(table) {
var paramsArray = $("#"+table+"").serializeArray();
var params = {};
for (var i = 0; i < paramsArray.length; i++) {
params[paramsArray[i].name] = paramsArray[i].value;
... ... @@ -302,7 +532,7 @@
$("#activateTalbe").datagrid(
{
url: contextPath + "/ActivateUnionRest/queryActivateDeviceId",
queryParams: getParams()
queryParams: getParam("searchForm")
});
}
... ... @@ -312,15 +542,36 @@
iconCls: "icon-search",
text: "查询",
onClick: function () {
// var params = getParams2();
// $.post(contextPath + "/ActivateUnionRest/queryByDeviceId", params, function (data) {
// var activate = data.data;
//
// }, "json");
$("#activateTalbe2").datagrid(
{
url: contextPath + "/ActivateUnionRest/queryByDeviceId",
queryParams: getParams2()
queryParams: getParam("searchForm2")
});
}
});
$("#clickBtn").linkbutton({
iconCls: "icon-search",
text: "查询",
onClick: function () {
$("#clickTable").datagrid(
{
url: contextPath + "/ClickUnionRest/queryUnionClickLogs",
queryParams: getParam("clickForm")
});
}
});
$("#openBtn").linkbutton({
iconCls: "icon-search",
text: "查询",
onClick: function () {
$("#openTable").datagrid(
{
url: contextPath + "/ClickUnionRest/queryUnionActivityLogs",
queryParams: getParam("openForm")
});
}
... ...
... ... @@ -247,6 +247,7 @@
$("#searchButton").linkbutton({
onClick: function () {
var param = getParams();
grid.datagrid('reload', getParams());
}
});
... ...