springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/user/RealUser.java
@@ -22,4 +22,6 @@ @ApiModelProperty("区域code") private String areaCode; private String communityId; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/user/UserProportion.java
@@ -23,6 +23,8 @@ @ApiModelProperty("社区名(按社区分组或指定街道时使用)") private String communityName; private String communityId; } springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/dao/UserDao.java
@@ -317,4 +317,11 @@ ComActAcidRecordVO selectComActAcidRecord(Long id); ComActAcidMemberVO selectComActAcidMember(Long id); /** * 获取本月的 * */ Integer getMonthUsers(@Param("streetId") Long streetId,@Param("areaCode") Long areaCode,@Param("range") String range); } springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
@@ -3444,23 +3444,29 @@ if (userProportions.size()>0){ for (UserProportion userProportion : userProportions) { if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(userProportion)){ log.info("统计数据"+userProportion); UserRateAnalysisVO vo=new UserRateAnalysisVO(); vo.setName(typeToName(type,userProportion )); if (monthRange){ if (userProportion.getCommunityId().equals("11")){ continue; } //获取本月的用户总数作为计算占比的用户总数 IndexDataKanbanVO data = userDao.dataKanBanStreet(streetId, areaCode, date); vo.setRate(getRate(data.getAllUser(),userProportion.getUser())); //IndexDataKanbanVO data = userDao.dataKanBanStreet(streetId, areaCode, date); Integer monthUsers = userDao.getMonthUsers(streetId, areaCode, date); vo.setRate(getRate(monthUsers,userProportion.getUser())); }else{ vo.setRate(getRate(analysisVO.getAllUser(),userProportion.getUser())); } vo.setName(typeToName(type,userProportion )); vo.setCount(userProportion.getUser()); log.info("统计后数据+"+vo); userRateAnalysisVOList.add(vo); } } } if (ObjectUtils.isEmpty(range)){ //查看累计数据时才计算其他用户的比例 final Boolean flag=(type.equals(ALLSTREET) || type.equals(ALLCOMMUNITY) || type.equals(BYSTREET) || type.equals(BYAREA)); //查看累计数据时才计算其他用户的比例 || type.equals(BYSTREET) || type.equals(BYAREA)) final Boolean flag=(type.equals(ALLSTREET) || type.equals(ALLCOMMUNITY)); if (flag){ UserRateAnalysisVO vo=new UserRateAnalysisVO(); vo.setName(OTHERUSER); @@ -3498,8 +3504,20 @@ List<RealUser> realUsers = userDao.realUserCount(type, date, streetId, areaCode); List<RealUserAnalysisVO> realUserList=new ArrayList<>(); realUserVO.setRealUserCount(getStreetRealUser(realUsers)); realUserVO.setRealUserRate(NumberUtil.div(realUserVO.getRealUserCount(), analysisVO.getAllUser()).doubleValue()); Integer rate = getRate(analysisVO.getAllUser(), realUserVO.getRealUserCount()); if (null == rate){ realUserVO.setRealUserRate(0.0); }else{ realUserVO.setRealUserRate(rate.doubleValue()); } for (RealUser realUser : realUsers) { if (!(type.equals(ALLCOUNTY))){ if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(realUser)){ if (realUser.getCommunityId().equals("11")){ continue; } } } RealUserAnalysisVO vo=new RealUserAnalysisVO(); vo.setCount(realUser.getCount()); vo.setName(typeToNameRealUser(type, realUser)); @@ -3713,6 +3731,7 @@ break; case "510402": name="东区"; break; case "510411": name="仁和区"; break; @@ -3730,6 +3749,7 @@ *根据type选择要设置的名称 * */ private String typeToName(Integer type,UserProportion proportion){ log.info("当前code"+proportion.getAreaCode()); String name=""; if (type.equals(ALLCOUNTY)){ name=areaCodeToName(proportion.getAreaCode()); springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/resources/mapper/UserDao.xml
@@ -564,7 +564,7 @@ select check_unit_id from com_pb_member where phone = #{phone} limit 1 </select> <select id="userAnalysis" resultType="com.panzhihua.common.model.vos.user.UserProportion"> select cs.area_code,cs.name as streetName,ac.name as communityName,count(su.user_id) as user from sys_user as su select cs.area_code,cs.name as streetName,ac.name as communityName,count(su.user_id) as user,su.community_id as communityId 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 where su.community_id<>'' @@ -599,7 +599,8 @@ limit 10 </select> <select id="realUserCount" resultType="com.panzhihua.common.model.vos.user.RealUser"> select cs.area_code as areaCode,cs.street_id,ac.name as communityName,cs.name as StreetName,count(su.user_id) as count from sys_user as su select cs.area_code as areaCode,cs.street_id,ac.name as communityName,su.community_id as communityId, cs.name as StreetName,count(su.user_id) as count 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 where su.community_id<>'' @@ -690,5 +691,21 @@ <select id="selectComActAcidMember" resultType="com.panzhihua.common.model.vos.community.acid.ComActAcidMemberVO"> select * from com_act_acid_member where id = #{id} </select> <select id="getMonthUsers" resultType="java.lang.Integer"> SELECT count(user_id) FROM sys_user t LEFT JOIN com_act t1 on t.community_id = t1.community_id where t.type=1 and t.community_id is not null and t.community_id<>11 <if test="streetId != null"> and t1.street_id=#{streetId} </if> <if test="areaCode != null"> and t1.area_code=#{areaCode} </if> <if test="range != null and range != ''"> and t.create_at >= #{range} </if> </select> </mapper>