Authored by Lixiaodi

点击数统计 实时

@@ -48,8 +48,8 @@ @@ -48,8 +48,8 @@
48 create_time >= #{beginTime,jdbcType=INTEGER} 48 create_time >= #{beginTime,jdbcType=INTEGER}
49 and create_time < #{endTime,jdbcType=INTEGER} 49 and create_time < #{endTime,jdbcType=INTEGER}
50 </delete> 50 </delete>
51 - <select id="selectCount">  
52 - select sum(num) from union_click_count_day 51 + <select id="selectCount" resultType="java.lang.Integer">
  52 + select case when sum(num) is null then 0 else sum(num) end from union_click_count_day
53 where union_type = #{unionType,jdbcType=VARCHAR} and client_type = #{clientType,jdbcType=INTEGER} and 53 where union_type = #{unionType,jdbcType=VARCHAR} and client_type = #{clientType,jdbcType=INTEGER} and
54 day_id &gt;= #{start,jdbcType=VARCHAR} and day_id &lt;= #{end,jdbcType=VARCHAR} 54 day_id &gt;= #{start,jdbcType=VARCHAR} and day_id &lt;= #{end,jdbcType=VARCHAR}
55 </select> 55 </select>
@@ -281,7 +281,7 @@ @@ -281,7 +281,7 @@
281 </select> 281 </select>
282 282
283 <select id="queryCountInfo" resultType="java.lang.Integer"> 283 <select id="queryCountInfo" resultType="java.lang.Integer">
284 - select count(*) from union_click_logs 284 + select CASE WHEN count(*) is null then 0 else count(*) end from union_click_logs
285 where union_type = #{unionType,jdbcType=BIGINT} and client_type = #{clientType,jdbcType=VARCHAR} and 285 where union_type = #{unionType,jdbcType=BIGINT} and client_type = #{clientType,jdbcType=VARCHAR} and
286 create_time &gt;= #{beginTime,jdbcType=INTEGER} 286 create_time &gt;= #{beginTime,jdbcType=INTEGER}
287 and create_time &lt; #{endTime,jdbcType=INTEGER} 287 and create_time &lt; #{endTime,jdbcType=INTEGER}
@@ -754,7 +754,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher @@ -754,7 +754,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
754 log.info("queryActivateCount dayStart is {}, now is {}, lastH is {}", format.format(new Date(dayStart * 1000L)), 754 log.info("queryActivateCount dayStart is {}, now is {}, lastH is {}", format.format(new Date(dayStart * 1000L)),
755 format.format(new Date(now * 1000L)), format.format(new Date(e * 1000L))); 755 format.format(new Date(now * 1000L)), format.format(new Date(e * 1000L)));
756 756
757 - String key = "yh:union:clickdata:" + unionType + ":" + formatDay.format(new Date(now * 1000L)); 757 + String key = "yh:union:clickdata:" + unionType + ":" + formatDay.format(new Date(now * 1000L)) + ":" + apptype;
758 Map<Integer, Integer> map = redisValueCache.get(key, Map.class); 758 Map<Integer, Integer> map = redisValueCache.get(key, Map.class);
759 759
760 log.info("queryActivateCount key is {}, getValue is {}", key, map); 760 log.info("queryActivateCount key is {}, getValue is {}", key, map);