| | |
| | | import com.panzhihua.common.model.vos.user.*; |
| | | import com.panzhihua.service_user.model.dos.SysUserDO; |
| | | import com.panzhihua.service_user.model.dtos.DataKanbanDTO; |
| | | import com.panzhihua.service_user.model.dtos.UsersStatisticsDTO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | |
| | | */ |
| | | Map<String, Long> getDailyAddAndActive(@Param("date") Date date, @Param("id") Long streetId, @Param("areaCode") Long areaCode, @Param("appId") String appId); |
| | | |
| | | Map<String, Long> getDailyAdd(@Param("createAt") String createAt, @Param("id") Long streetId, @Param("areaCode") Long areaCode, @Param("appId") String appId); |
| | | List<UsersStatisticsDTO> getDailyAdd(@Param("createAt") String createAt, @Param("id") Long streetId, @Param("areaCode") Long areaCode, @Param("appId") String appId); |
| | | |
| | | Map<String, Long> getActive(@Param("lastLoginTime") String lastLoginTime, @Param("id") Long streetId, @Param("areaCode") Long areaCode, @Param("appId") String appId); |
| | | List<UsersStatisticsDTO> getActive(@Param("lastLoginTime") String lastLoginTime, @Param("id") Long streetId, @Param("areaCode") Long areaCode, @Param("appId") String appId); |
| | | |
| | | |
| | | List<StreetVOS> selectStreetByAreaCode(Integer code); |
New file |
| | |
| | | package com.panzhihua.service_user.model.dtos; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @ClassName: UsersStatisticsDTO |
| | | * @Author: yh |
| | | * @Date: 2022/10/17 10:26 |
| | | * @Description: 对登录人数和新增人数进行统计 |
| | | * com.panzhihua.service_user.model.dtos.UsersStatisticsDTO |
| | | */ |
| | | @Data |
| | | public class UsersStatisticsDTO { |
| | | |
| | | |
| | | /** |
| | | * 年月日 |
| | | */ |
| | | private String specificDate; |
| | | |
| | | /** |
| | | * 总数 |
| | | */ |
| | | private String total; |
| | | } |
| | |
| | | import com.panzhihua.service_user.entity.SysTemplateConfig; |
| | | import com.panzhihua.service_user.model.dos.*; |
| | | import com.panzhihua.service_user.model.dtos.DataKanbanDTO; |
| | | import com.panzhihua.service_user.model.dtos.UsersStatisticsDTO; |
| | | import com.panzhihua.service_user.service.EventGridMemberBuildingRelationService; |
| | | import com.panzhihua.service_user.service.UserService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | } |
| | | |
| | | //获取最近活跃人数 |
| | | 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("activeUser").toString() : "0"); |
| | | adY.add(dailyAddMap.containsKey(dateStr) ? dailyAddMap.get("addUser").toString() : "0"); |
| | | |
| | | } |
| | | vo.setUserX(getMAndD(activeDate)); |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="getDailyAdd" resultType="java.util.Map"> |
| | | SELECT DATE_FORMAT( su.create_at, '%Y-%m-%d' ) as createAt ,count(su.user_id) as addUser FROM |
| | | <select id="getDailyAdd" resultType="com.panzhihua.service_user.model.dtos.UsersStatisticsDTO"> |
| | | SELECT DATE_FORMAT( su.create_at, '%Y-%m-%d' ) as specificDate ,count(su.user_id) as total FROM |
| | | sys_user AS su |
| | | LEFT JOIN com_act AS ac ON su.community_id = ac.community_id |
| | | LEFT JOIN com_street AS cs ON ac.street_id = cs.street_id |
| | |
| | | </if> |
| | | AND su.create_at > #{createAt} GROUP BY createAt |
| | | </select> |
| | | <select id="getActive" resultType="java.util.Map"> |
| | | SELECT DATE_FORMAT( su.last_login_time, '%Y-%m-%d' ) as createAt ,count(su.user_id) as activeUser FROM |
| | | <select id="getActive" resultType="com.panzhihua.service_user.model.dtos.UsersStatisticsDTO"> |
| | | SELECT DATE_FORMAT( su.last_login_time, '%Y-%m-%d' ) as specificDate ,count(su.user_id) as total FROM |
| | | sys_user AS su |
| | | LEFT JOIN com_act AS ac ON su.community_id = ac.community_id |
| | | LEFT JOIN com_street AS cs ON ac.street_id = cs.street_id |