Authored by mingdan.ge

no message

... ... @@ -4,14 +4,14 @@
<resultMap id="BaseResultMap" type="com.yoho.unions.dal.model.UnionShareBigDataClick" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="date_id" property="dateId" jdbcType="INTEGER" />
<result column="usershare_union_type" property="userShareUnionType" jdbcType="VARCHAR" />
<result column="usershare_union_type" property="usershareUnionType" jdbcType="VARCHAR" />
<result column="click_visit" property="clickVisit" jdbcType="INTEGER" />
<result column="click_uv" property="clickUv" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
id, date_id, usershare_union_type, click_visit, click_uv
</sql>
<select id="selectByUnionTypeAndDate" resultMap="BaseResultMap" parameterType="java.lang.String" >
<select id="selectByUnionTypeAndDate" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from app_ad_union_usershare_click
... ...
... ... @@ -1684,20 +1684,20 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
rspBo.setOrderAmountSum(orderAmountSum);
rspBo.setExtraAmountSum(extraAmountSum);
rspBo.setOrderNum(orderNum);
rspBo.setClickNum(getClickNum(bo.getUid()));//点击数
rspBo.setClickNum(getClickNum(bo.getUid(), paramMap.get("startDate"), paramMap.get("endDate")));//点击数
//设置缓存
addToRedis(ShareOrdersKeyEnum.ORDER_STATISTICS_INFO,bo.getUid(),rspBo,bo.getQueryTimeType().toString());
return rspBo;
}
private int getClickNum(Integer uid) {
private int getClickNum(Integer uid, Integer startDate, Integer endDate) {
UnionShareUser unionShareUser = unionShareUserMapper.selectByUid(uid);
if(null == unionShareUser) {
return 0;
}
String unionType = unionShareUser.getUnionType();
UnionShareBigDataClick clickInfo = unionShareBigDataClickMapper.selectByUnionType(unionType);
UnionShareBigDataClick clickInfo = unionShareBigDataClickMapper.selectByUnionTypeAndDate(unionType, startDate, endDate);
if(null == clickInfo) {
return 0;
}
... ... @@ -1710,19 +1710,19 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
Map<String, Integer> paramMap = Maps.newHashMap();
Integer startTime = null;
Integer endTime = null;
Integer startDate = null;
Integer endDate = null;
String currentDate = DateUtil.getcurrentDate();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
if(queryTimeType.byteValue() == STATISTICS_QUERY_TIME_YESTERDAY) {//统计昨日数据
String yesterdayTime = DateUtil.dateAdd(currentDate, "d", -1, "yyyy-MM-dd");
startTime = (int)((format.parse(yesterdayTime + " 00:00:00").getTime())/1000);
endTime = (int)((format.parse(yesterdayTime + " 59:59:59").getTime())/1000);
endTime = (int)((format.parse(yesterdayTime + " 23:59:59").getTime())/1000);
}else if(queryTimeType.byteValue() == STATISTICS_QUERY_TIME_CURRENT_MONTH) {
String currentMonth = currentDate.substring(0, 7);
startTime = (int)((format.parse(currentMonth + "-01 00:00:00").getTime())/1000);
endTime = (int)((format.parse(currentDate + " 59:59:59").getTime())/1000);
endTime = (int)((format.parse(currentDate + " 23:59:59").getTime())/1000);
}else if(queryTimeType.byteValue() == STATISTICS_QUERY_TIME_LAST_MONTH) {
String currentMonth = currentDate.substring(0, 7);
//当月第一天
... ... @@ -1731,16 +1731,20 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
String lastMonthLastDay= DateUtil.dateAdd(currentMonthFirstDay, "d", -1, "yyyy-MM-dd");
String lastMonth = DateUtil.dateAdd(currentMonth, "m", -1, "yyyy-MM");
startTime = (int)((format.parse(lastMonth + "-01 00:00:00").getTime())/1000);
endTime = (int)((format.parse(lastMonthLastDay + " 59:59:59").getTime())/1000);
endTime = (int)((format.parse(lastMonthLastDay + " 23:59:59").getTime())/1000);
}
} catch (ParseException e) {
logger.error("UnionShareServiceImpl::getQueryParam find error!!!");
}
startDate = Integer.valueOf(DateUtil.long2DateStr(Long.valueOf(startTime+"000"), "yyyyMMdd"));
endDate = Integer.valueOf(DateUtil.long2DateStr(Long.valueOf(endTime+"000"), "yyyyMMdd"));
paramMap.put("startTime", startTime);
paramMap.put("endTime", endTime);
paramMap.put("startDate", startDate);
paramMap.put("endDate", endDate);
return paramMap;
}
}
... ...