|
@@ -30,7 +30,7 @@ public class ScheduleTask {
|
|
|
|
|
|
@Scheduled(cron = "0 0 0 * * ?")
|
|
@Scheduled(cron = "0 0 0 * * ?")
|
|
//@Scheduled(cron = "30 * * * * ?")
|
|
//@Scheduled(cron = "30 * * * * ?")
|
|
- public void statisticsH5Data() {
|
|
|
|
|
|
+ public void statisticsH5Data() throws Exception {
|
|
if(day == null){
|
|
if(day == null){
|
|
day = DateUtil.getDay(new Date(), -1);
|
|
day = DateUtil.getDay(new Date(), -1);
|
|
}
|
|
}
|
|
@@ -42,9 +42,10 @@ public class ScheduleTask {
|
|
BigDecimal jumpCount = BigDecimal.ZERO;
|
|
BigDecimal jumpCount = BigDecimal.ZERO;
|
|
BigDecimal clickGameCount = BigDecimal.ZERO;
|
|
BigDecimal clickGameCount = BigDecimal.ZERO;
|
|
BigDecimal clickShopCount = BigDecimal.ZERO;
|
|
BigDecimal clickShopCount = BigDecimal.ZERO;
|
|
|
|
+ Long totalVideoNum = 0L;
|
|
|
|
+ Long totalStepNum = 0L;
|
|
for (PageData pageData : list) {
|
|
for (PageData pageData : list) {
|
|
- stopTimeCount += pageData.getStopTime();
|
|
|
|
- if(pageData.getIsJump() == 1){
|
|
|
|
|
|
+ if(pageData.getStepNum() == 0){
|
|
jumpCount = jumpCount.add(new BigDecimal(1));
|
|
jumpCount = jumpCount.add(new BigDecimal(1));
|
|
}
|
|
}
|
|
if(pageData.getIsClickGame() == 1){
|
|
if(pageData.getIsClickGame() == 1){
|
|
@@ -53,16 +54,27 @@ public class ScheduleTask {
|
|
if(pageData.getIsClickShop() == 1){
|
|
if(pageData.getIsClickShop() == 1){
|
|
clickShopCount = clickShopCount.add(new BigDecimal(1));
|
|
clickShopCount = clickShopCount.add(new BigDecimal(1));
|
|
}
|
|
}
|
|
|
|
+ if(pageData.getStopTime() == 0){
|
|
|
|
+ String inPageTime = pageData.getInPageTime();
|
|
|
|
+ String outPageTime = pageData.getOutPageTime() == null ? day+ " 23:59:59" :pageData.getOutPageTime();
|
|
|
|
+ long time = DateUtil.getDateTime(outPageTime) - DateUtil.getDateTime(inPageTime);
|
|
|
|
+ pageData.setStopTime(time);
|
|
|
|
+ }
|
|
|
|
+ stopTimeCount += pageData.getStopTime();
|
|
|
|
+ totalVideoNum += pageData.getVideoNum();
|
|
|
|
+ totalStepNum += pageData.getStepNum();
|
|
}
|
|
}
|
|
- Long avgStopTime = 0L;
|
|
|
|
|
|
+ long avgStopTime = 0L;
|
|
BigDecimal avgJump = BigDecimal.ZERO;
|
|
BigDecimal avgJump = BigDecimal.ZERO;
|
|
BigDecimal avgClickGame = BigDecimal.ZERO;
|
|
BigDecimal avgClickGame = BigDecimal.ZERO;
|
|
BigDecimal avgClickShop = BigDecimal.ZERO;
|
|
BigDecimal avgClickShop = BigDecimal.ZERO;
|
|
|
|
+ Long avgStepNum = 0L;
|
|
if(list.size()>0){
|
|
if(list.size()>0){
|
|
avgStopTime = (stopTimeCount / list.size())/1000;
|
|
avgStopTime = (stopTimeCount / list.size())/1000;
|
|
avgJump = jumpCount.divide(new BigDecimal(list.size()),4,BigDecimal.ROUND_HALF_UP);
|
|
avgJump = jumpCount.divide(new BigDecimal(list.size()),4,BigDecimal.ROUND_HALF_UP);
|
|
avgClickGame = clickGameCount.divide(new BigDecimal(list.size()),4,BigDecimal.ROUND_HALF_UP);
|
|
avgClickGame = clickGameCount.divide(new BigDecimal(list.size()),4,BigDecimal.ROUND_HALF_UP);
|
|
avgClickShop = clickShopCount.divide(new BigDecimal(list.size()),4,BigDecimal.ROUND_HALF_UP);
|
|
avgClickShop = clickShopCount.divide(new BigDecimal(list.size()),4,BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ avgStepNum = totalStepNum / list.size();
|
|
}
|
|
}
|
|
TotalData totalData = new TotalData();
|
|
TotalData totalData = new TotalData();
|
|
totalData.setId(day);
|
|
totalData.setId(day);
|
|
@@ -70,6 +82,8 @@ public class ScheduleTask {
|
|
totalData.setAvgJump(avgJump);
|
|
totalData.setAvgJump(avgJump);
|
|
totalData.setAvgClickGame(avgClickGame);
|
|
totalData.setAvgClickGame(avgClickGame);
|
|
totalData.setAvgClickShop(avgClickShop);
|
|
totalData.setAvgClickShop(avgClickShop);
|
|
|
|
+ totalData.setVideoNum(totalVideoNum);
|
|
|
|
+ totalData.setAvgStepNum(avgStepNum);
|
|
totalDataService.saveOrUpdate(totalData);
|
|
totalDataService.saveOrUpdate(totalData);
|
|
|
|
|
|
log.info("{发送{}的统计结果{}给海鲲,{}",day,totalData,DateUtil.getDateTime(new Date()));
|
|
log.info("{发送{}的统计结果{}给海鲲,{}",day,totalData,DateUtil.getDateTime(new Date()));
|