Commit 37eb0b5e authored by 赵啸非's avatar 赵啸非

Merge remote-tracking branch 'origin/master'

parents 12f07d62 21dff7ec
...@@ -35,4 +35,6 @@ public class RedisKey { ...@@ -35,4 +35,6 @@ public class RedisKey {
public static final String KEY_DEVICE_EVENT_CLICK_CACHE = "device:event:click"; public static final String KEY_DEVICE_EVENT_CLICK_CACHE = "device:event:click";
public static final String KEY_DEVICE_EVENT_CLICK_CACHE_DAY = "device:event:click:day";
} }
...@@ -4,6 +4,7 @@ import com.mortals.framework.exception.AppException; ...@@ -4,6 +4,7 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICacheService; import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.common.code.YesNoEnum; import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.key.RedisKey; import com.mortals.xhx.common.key.RedisKey;
...@@ -88,6 +89,18 @@ public class PageEventServiceImpl extends AbstractCRUDServiceImpl<PageEventDao, ...@@ -88,6 +89,18 @@ public class PageEventServiceImpl extends AbstractCRUDServiceImpl<PageEventDao,
pageEventCensusVo.setTotal(pageEventCensusVo.getTotal()+1); pageEventCensusVo.setTotal(pageEventCensusVo.getTotal()+1);
cacheService.hset(RedisKey.KEY_DEVICE_EVENT_CLICK_CACHE, key, pageEventCensusVo); cacheService.hset(RedisKey.KEY_DEVICE_EVENT_CLICK_CACHE, key, pageEventCensusVo);
} }
PageEventCensusVo pageEventCensusVoDay = cacheService.hget(RedisKey.KEY_DEVICE_EVENT_CLICK_CACHE_DAY,key,PageEventCensusVo.class);
if(ObjectUtils.isEmpty(pageEventCensusVoDay)){
pageEventCensusVoDay = new PageEventCensusVo();
pageEventCensusVoDay.setProductId(entity.getProductId());
pageEventCensusVoDay.setEventCode("Click");
pageEventCensusVoDay.setEventName("点击");
pageEventCensusVoDay.setTotal(1);
cacheService.hset(RedisKey.KEY_DEVICE_EVENT_CLICK_CACHE_DAY, key, pageEventCensusVoDay);
}else {
pageEventCensusVoDay.setTotal(pageEventCensusVoDay.getTotal()+1);
cacheService.hset(RedisKey.KEY_DEVICE_EVENT_CLICK_CACHE_DAY, key, pageEventCensusVoDay);
}
} }
} }
} }
...@@ -311,10 +324,19 @@ public class PageEventServiceImpl extends AbstractCRUDServiceImpl<PageEventDao, ...@@ -311,10 +324,19 @@ public class PageEventServiceImpl extends AbstractCRUDServiceImpl<PageEventDao,
if(CollectionUtils.isNotEmpty(list)) { if(CollectionUtils.isNotEmpty(list)) {
cacheService.hset(RedisKey.KEY_DEVICE_EVENT_CLICK_CACHE, entry.getKey(), list.get(0)); cacheService.hset(RedisKey.KEY_DEVICE_EVENT_CLICK_CACHE, entry.getKey(), list.get(0));
} }
query.setDateTimeStart(DateUtils.getCurrDateTime("yyyy-MM-dd"));
query.setDateTimeEnd(DateUtils.getCurrDateTime("yyyy-MM-dd"));
List<PageEventCensusVo> listDay = dao.getPageClickEventCensus(query);
if(CollectionUtils.isNotEmpty(listDay)) {
cacheService.hset(RedisKey.KEY_DEVICE_EVENT_CLICK_CACHE_DAY, entry.getKey(), listDay.get(0));
}
} }
} }
} }
return null; return null;
} }
public static void main(String[] args) {
System.out.println(DateUtils.getCurrDateTime("yyyy-MM-dd"));
}
} }
\ No newline at end of file
...@@ -359,6 +359,16 @@ public class PageCensusController extends BaseJsonBodyController { ...@@ -359,6 +359,16 @@ public class PageCensusController extends BaseJsonBodyController {
} }
model.put("data", pageEventCensusVo); model.put("data", pageEventCensusVo);
PageEventCensusVo pageEventCensusVoDay = cacheService.hget(RedisKey.KEY_DEVICE_EVENT_CLICK_CACHE_DAY,key,PageEventCensusVo.class);
if(null == pageEventCensusVoDay){
pageEventCensusVoDay = new PageEventCensusVo();
pageEventCensusVoDay.setProductId(query.getProductId());
pageEventCensusVoDay.setEventCode("Click");
pageEventCensusVoDay.setEventName("点击");
pageEventCensusVoDay.setTotal(0);
}
model.put("dataDay", pageEventCensusVoDay);
model.put("message_info", busiDesc + "成功"); model.put("message_info", busiDesc + "成功");
} }
......
...@@ -187,6 +187,12 @@ ...@@ -187,6 +187,12 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="dateTimeStart!=null and dateTimeStart!=''">
AND t.createTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{dateTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="dateTimeEnd!=null and dateTimeEnd!=''">
AND t.createTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{dateTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if>
GROUP BY GROUP BY
t.eventCode, t.eventCode,
t.eventName t.eventName
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment