yanghui
2022-10-17 a9a660a85f54911a76aefd1eb29a3af0c7b0e419
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
@@ -17,6 +17,7 @@
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -1580,6 +1581,10 @@
        }
        page.setSize(pageSize);
        page.setCurrent(pageNum);
        if (StrUtil.isEmpty(sysOperLogVO.getStartTime()) && StrUtil.isEmpty(sysOperLogVO.getEndTime())){
            sysOperLogVO.setStartTime(com.panzhihua.common.utlis.DateUtils.getBeforeDay(30));
            sysOperLogVO.setEndTime(com.panzhihua.common.utlis.DateUtils.getCurrentDateymd());
        }
        IPage<SysOperLogVO> iPage = sysOperLogDAO.pageOperLog(page, sysOperLogVO);
        return R.ok(iPage);
    }
@@ -3558,15 +3563,18 @@
                activeDate = getMonthTwentyDays();
            }
        }
        //获取最近活跃人数
        Map<String, Long> active = userDao.getActive(activeX, streetId, areaCode, appId);
        List<UsersStatisticsDTO> actives = userDao.getActive(activeX, streetId, areaCode, appId);
        //获取最近注册人数
        Map<String, Long> dailyAdd = userDao.getDailyAdd(activeX, streetId, areaCode, appId);
        List<UsersStatisticsDTO> dailyAdds = userDao.getDailyAdd(activeX, streetId, areaCode, appId);
        Map<String, String> activeMap = actives.stream().collect(Collectors.toMap(UsersStatisticsDTO::getSpecificDate, UsersStatisticsDTO::getTotal));
        Map<String, String> dailyAddMap = dailyAdds.stream().collect(Collectors.toMap(UsersStatisticsDTO::getSpecificDate, UsersStatisticsDTO::getTotal));
        for (Date date : activeDate) {
            String dateStr = DateUtil.format(date, "yyyy-MM-dd");
            activeY.add(active.containsKey(dateStr) ? active.get("activeUser").toString() : "0");
            adY.add(dailyAdd.containsKey(dateStr) ? dailyAdd.get("addUser").toString() : "0");
            activeY.add(activeMap.containsKey(dateStr) ? activeMap.get(dateStr) : "0");
            adY.add(dailyAddMap.containsKey(dateStr) ? dailyAddMap.get(dateStr) : "0");
        }
        vo.setUserX(getMAndD(activeDate));