Authored by caoyan

cps四期

... ... @@ -14,14 +14,14 @@
<result column="amount" property="amount" jdbcType="DECIMAL" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
<result column="activity_type" property="activityType" jdbcType="INTEGER" />
<!-- <result column="activity_type" property="activityType" jdbcType="INTEGER" /> -->
<result column="activity_id" property="activityId" jdbcType="INTEGER" />
<result column="extra_amount" property="extraAmount" jdbcType="DECIMAL" />
<result column="order_amount" property="orderAmount" jdbcType="DECIMAL" />
</resultMap>
<sql id="Base_Column_List" >
id, order_code,settlement_code, promote_uid,order_uid, status, last_order_amount, order_time, is_new, amount, create_time,
update_time,activity_type,activity_id,extra_amount,order_amount
update_time,activity_id,extra_amount,order_amount
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
... ...
... ... @@ -1618,20 +1618,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;
}
... ... @@ -1644,19 +1644,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);
//当月第一天
... ... @@ -1665,16 +1665,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;
}
}
... ...