Authored by linlong

update

... ... @@ -30,6 +30,7 @@
<value>/ActivateUnionRest/queryActivateDeviceId</value>
<value>/UnionRest/addYas</value>
<value>/ActivateUnionRest/queryActivateCount</value>
<value>/ActivateUnionRest/queryActivateHour</value>
<value>/ActivateUnionRest/queryByDeviceId</value>
<value>/jump</value>
<value>/go</value>
... ...
... ... @@ -38,4 +38,6 @@ public interface IUnionLogsDAO {
List<UnionLogs> matchIdfa(@Param("list") List<String> list,@Param("isIdfa") int isIdfa);
List<UnionLogs> queryByDeviceId(ActivateDeviceIdReqBO activateDeviceIdReqBO);
List<ActivateDeviceIdRspBO> selectListByHour(ActivateDeviceIdReqBO activateDeviceIdReqBO);
}
... ...
... ... @@ -194,8 +194,11 @@
<if test="interfaceType != null and interfaceType !='' ">
and interface_type=#{interfaceType}
</if>
<if test="activateTimeStr != null and activateTimeStr>0">
and create_time>=#{activateTimeStr,jdbcType=INTEGER} and create_time-86400 &lt;=#{activateTimeStr,jdbcType=INTEGER}
<if test="activateTimeBegin != null and activateTimeBegin>0">
and create_time>=#{activateTimeBegin,jdbcType=INTEGER}
</if>
<if test="activateTimeEnd != null and activateTimeEnd>0">
and create_time &lt;=#{activateTimeEnd,jdbcType=INTEGER}
</if>
group by union_type
</select>
... ... @@ -210,8 +213,11 @@
<if test="interfaceType != null and interfaceType !='' ">
and interface_type=#{interfaceType}
</if>
<if test="activateTimeStr != null and activateTimeStr>0">
and create_time>=#{activateTimeStr,jdbcType=INTEGER} and create_time-86400 &lt;=#{activateTimeStr,jdbcType=INTEGER}
<if test="activateTimeBegin != null and activateTimeBegin>0">
and create_time>=#{activateTimeBegin,jdbcType=INTEGER}
</if>
<if test="activateTimeEnd != null and activateTimeEnd>0">
and create_time &lt;=#{activateTimeEnd,jdbcType=INTEGER}
</if>
group by union_type
</select>
... ...
... ... @@ -148,13 +148,17 @@
<if test="interfaceType != null and interfaceType !='' ">
and interface_type=#{interfaceType}
</if>
<if test="activateTimeStr != null and activateTimeStr>0">
and create_time>=#{activateTimeStr,jdbcType=INTEGER} and create_time-86400 &lt;=#{activateTimeStr,jdbcType=INTEGER}
<if test="activateTimeBegin != null and activateTimeBegin>0">
and create_time>=#{activateTimeBegin,jdbcType=INTEGER}
</if>
<if test="activateTimeEnd != null and activateTimeEnd>0">
and create_time &lt;=#{activateTimeEnd,jdbcType=INTEGER}
</if>
<if test="unionType !=null and unionType !='' ">
and union_type = #{unionType}
</if>
group by union_type
order by count(idfa) desc,count(imei) desc
</select>
<select id="matchIdfa" resultMap="BaseResultMap">
select
... ... @@ -184,4 +188,16 @@
</if>
limit 1
</select>
<select id="selectListByHour" resultMap="ActivateMap"
parameterType="com.yoho.service.model.union.request.ActivateDeviceIdReqBO">
select union_type,union_name,count(idfa) as idfa_count,count(imei) as imei_count
from union_logs
where union_type = #{unionType}
<if test="activateHourBegin != null and activateHourBegin>0">
and create_time>=#{activateHourBegin,jdbcType=INTEGER}
</if>
<if test="activateHourEnd != null and activateHourEnd>0">
and create_time &lt;=#{activateHourEnd,jdbcType=INTEGER}
</if>
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -222,6 +222,27 @@ public class ActivateUnionRest {
}
}
/**
* 统计每小时的激活IDFA
* @param activateDeviceIdReqBO
* @return
*/
@RequestMapping("/queryActivateHour")
@ResponseBody
public ApiResponse queryActivateHour(ActivateDeviceIdReqBO activateDeviceIdReqBO){
log.info("enter queryActivateHour. param activateDeviceIdReqBO={}", activateDeviceIdReqBO);
if(activateDeviceIdReqBO==null){
return new ApiResponse.ApiResponseBuilder().code(500).message("缺少参数").build();
}
try {
PageActivateDeviceIdRspBO pageActivateDeviceIdRspBO = unionService.queryActivateHour(activateDeviceIdReqBO);
return new ApiResponse.ApiResponseBuilder().code(200).message("成功").data(pageActivateDeviceIdRspBO).build();
} catch (Exception e) {
log.warn("queryActivateHour occurs Exception e {}",e.getMessage());
return new ApiResponse.ApiResponseBuilder().code(500).message("失败").build();
}
}
@RequestMapping("/queryActivateCount")
@ResponseBody
... ...
... ... @@ -79,4 +79,6 @@ public interface IUnionService {
PageUnionClickLogsRspBO queryUnionClickLogs(UnionLogsReqBO unionLogsReqBO);
PageUnionActivityLogsRspBO queryUnionActivityLogs(UnionLogsReqBO unionLogsReqBO);
PageActivateDeviceIdRspBO queryActivateHour(ActivateDeviceIdReqBO activateDeviceIdReqBO);
}
... ...
... ... @@ -39,6 +39,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.BeanUtils;
import org.springframework.cache.interceptor.CacheableOperation;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.stereotype.Service;
... ... @@ -573,12 +574,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
@Override
public PageActivateDeviceIdRspBO queryActivateDeviceId(ActivateDeviceIdReqBO activateDeviceIdReqBO) {
log.info("enter queryActivateDeviceId. param activateDeviceIdReqBO={}", activateDeviceIdReqBO);
if(StringUtils.isEmpty(activateDeviceIdReqBO.getActivateTime())){
activateDeviceIdReqBO.setActivateTimeStr(DateUtils.getTodayZero());
}else{
String dateStr = activateDeviceIdReqBO.getActivateTime().replaceAll("-","/");
activateDeviceIdReqBO.setActivateTimeStr(DateUtils.getTimesmorning(dateStr));
}
//(1).查询出各渠道激活的设备id数
List<ActivateDeviceIdRspBO> activateDeviceIdRspList = unionLogsDAO.selectListByParam(activateDeviceIdReqBO);
... ... @@ -600,12 +596,12 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
public Integer queryActivateCount(ActivateDeviceIdReqBO activateDeviceIdReqBO) {
log.info("enter queryActivateCount. param activateDeviceIdReqBO={}", activateDeviceIdReqBO);
Integer count = 0;
if(StringUtils.isEmpty(activateDeviceIdReqBO.getActivateTime())){
activateDeviceIdReqBO.setActivateTimeStr(DateUtils.getTodayZero());
}else{
String dateStr = activateDeviceIdReqBO.getActivateTime().replaceAll("-","/");
activateDeviceIdReqBO.setActivateTimeStr(DateUtils.getTimesmorning(dateStr));
}
// if(StringUtils.isEmpty(activateDeviceIdReqBO.getActivateTime())){
// activateDeviceIdReqBO.setActivateTimeStr(DateUtils.getTodayZero());
// }else{
// String dateStr = activateDeviceIdReqBO.getActivateTime().replaceAll("-","/");
// activateDeviceIdReqBO.setActivateTimeStr(DateUtils.getTimesmorning(dateStr));
// }
if(activateDeviceIdReqBO.getIsIdfa()>0 ){
//ios查询时,接口为全部或者是ios接口才查询
if(IOS_INTERFACE_LIST.contains(activateDeviceIdReqBO.getInterfaceType())||StringUtils.isEmpty(activateDeviceIdReqBO.getInterfaceType())){
... ... @@ -799,5 +795,35 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
return page;
}
@Override
public PageActivateDeviceIdRspBO queryActivateHour(ActivateDeviceIdReqBO activateDeviceIdReqBO) {
log.info("enter queryActivateHour. param activateDeviceIdReqBO={}", activateDeviceIdReqBO);
//(1).查询出各渠道激活的设备id数
List<ActivateDeviceIdRspBO> activateDeviceIdRspList = Lists.newArrayList();
int beginTime = DateUtils.getTodayZero();
for(int i=0;i<24;i++){
activateDeviceIdReqBO.setActivateHourBegin(beginTime);
activateDeviceIdReqBO.setActivateHourEnd(beginTime+3600);
activateDeviceIdRspList.addAll(unionLogsDAO.selectListByHour(activateDeviceIdReqBO));
beginTime +=3600;
}
for(int i=0;i<24;i++){
ActivateDeviceIdRspBO bo = activateDeviceIdRspList.get(i);
String hour = i<10?"0"+i+":00--"+"0"+i+":59":i+":00--"+i+":59";
bo.setHour(hour);
}
PageActivateDeviceIdRspBO pageActivateDeviceIdRspBO = new PageActivateDeviceIdRspBO();
pageActivateDeviceIdRspBO.setList(activateDeviceIdRspList);
//不需要分页了
// pageActivateDeviceIdRspBO.setTotal(total);
// pageActivateDeviceIdRspBO.setPage(activateDeviceIdReqBO.getPage());
return pageActivateDeviceIdRspBO;
}
}
... ...
<table id="activateHour"></table>
<script type="text/javascript">
$(function () {
// 列表
var grid2 = $("#activateHour");
grid2.myDatagrid({
fit: true,
fitColumns: true,
nowrap: false,
url: contextPath + "/ActivateUnionRest/queryActivateHour",
method: 'POST',
queryParams: getId(),
loadFilter: function (data) {
var temp = defaultLoadFilter(data);
temp.rows = temp.list;
return temp;
},
columns: [[{
title: "时间",
field: "hour",
width: 100,
align: "center"
}, {
title: "ios激活数",
field: "idfaCount",
width: 180,
align: "center"
}, {
title: "安卓激活数",
field: "imeiCount",
width: 120,
align: "center"
}]],
cache: false,
pageSize: 10,
pageList: [10],
singleSelect: false,
checkOnSelect: false
});
function getId() {
var params = {};
params["unionType"] = unionType;
return params;
}
});
</script>
\ No newline at end of file
... ...
... ... @@ -51,8 +51,10 @@
]"/>
<input name="unionType" type="text" class="easyui-textbox" data-options="prompt:'请输入渠道号'"
style="width: 200px;">
<input id="activateTime" name="activateTime" type="text" class="easyui-datebox" editable="false"
data-options="prompt:'请选择激活日期'" style="width: 200px;">
<input id="activateTimeBegin" name="activateTimeBegin" type="text" class="easyui-datetimebox" editable="false"
data-options="prompt:'激活开始时间'" style="width: 200px;">
<input id="activateTimeEnd" name="activateTimeEnd" type="text" class="easyui-datetimebox" editable="false"
data-options="prompt:'激活结束时间'" style="width: 200px;">
<a id="searchBtn" class="easyui-linkbutton btn-info" style="margin-left: 30px; "></a>
</form>
</div>
... ... @@ -195,7 +197,8 @@
var currentDate = getNowFormatDate();
var currentDateBegin = currentDate+" 00:00:00";
var currentDateEnd = currentDate+" 23:59:59";
$('#activateTime').datebox('setValue', currentDate);
$('#activateTimeBegin').datetimebox('setValue', currentDateBegin);
$('#activateTimeEnd').datetimebox('setValue', currentDateEnd);
$('#clickTimeBegin').datetimebox('setValue', currentDateBegin);
$('#clickTimeEnd').datetimebox('setValue', currentDateEnd);
... ... @@ -254,7 +257,16 @@
var str = "<a role='imei' dataId='" + rowData.unionType + "' style='margin-left:10px'></a>";
return str;
}
}
}, {
title: "当天每小时激活数",
field: "asdf",
width: 180,
align: "center",
formatter: function (value, rowData, rowIndex) {
var str = "<a role='hour' dataId='" + rowData.unionType + "' style='margin-left:10px'></a>";
return str;
}
}
]],
cache: false,
pageSize: 10,
... ... @@ -299,6 +311,15 @@
}
});
$(this).myDatagrid("getPanel").find("a[role='hour']").linkbutton({
iconCls: "icon-more",
text: '查看',
onClick: function () {
showActivateHour($(this).attr("dataId"));
return false;
}
});
$('#activateTalbe').datagrid('appendRow', {
unionType: '<span class="subtotal">统计</span>',
unionName: '<span class="subtotal"></span>',
... ... @@ -320,6 +341,28 @@
}
});
function showActivateHour(id) {
unionType = id;
var div = $("<div>").appendTo($(window.self.document.body));
window.self.$(div).myDialog({
modal : true,
collapsible : true,
cache : false,
title : "每小时点击量",
width: 600,
height: 600,
href: contextPath + "/admin/activateHour.html?unionType="+id,
buttons : [{
id : "closeBtn",
text : "关闭",
iconCls : "icon-cancel",
handler : function() {
window.self.$(div).dialog('close');
}
}]
});
}
$("#activateTalbe2").myDatagrid({
fit: true,
fitColumns: true,
... ... @@ -358,10 +401,10 @@
width: 180,
align: "center"
}, {
title: "激活接口",
field: "interfaceType",
width: 180,
align: "center"
title: "激活接口",
field: "interfaceType",
width: 180,
align: "center"
}
]],
cache: false,
... ... @@ -599,7 +642,7 @@
height: 250
});
console.info(data)
var match = data.data;
// var match = data.data;
$("#activateTalbe2").datagrid('loadData', data);
// var output = "匹配的内容</br>";
// for (var i = 0; i < match.length; i++) {
... ... @@ -623,8 +666,8 @@
msg: "匹配完成",
height: 250
});
var match = data.data;
$("#activateTalbe2").datagrid('loadData', match);
// var match = data.data;
$("#activateTalbe2").datagrid('loadData', data);
// var output = "匹配的内容</br>";
// for (var i = 0; i < match.length; i++) {
// output += JSON.stringify(match[i])+"</br>";
... ...