| | |
| | | |
| | | import cn.hutool.core.util.IdcardUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | // import com.panzhihua.common.service.grid.GridService; |
| | | |
| | |
| | | if(StringUtils.isNotEmpty(areaName)){ |
| | | loginUserInfoVO.setAreaName(areaName); |
| | | } |
| | | SysAppConfig sysAppConfig=sysAppConfigDao.selectOne(new QueryWrapper<SysAppConfig>().lambda().eq(SysAppConfig::getAreaCode,comActVO.getAreaCode())); |
| | | if(sysAppConfig!=null){ |
| | | loginUserInfoVO.setAppId(sysAppConfig.getAppId()); |
| | | loginUserInfoVO.setAppSecret(sysAppConfig.getSecret()); |
| | | } |
| | | // SysAppConfig sysAppConfig=sysAppConfigDao.selectOne(new QueryWrapper<SysAppConfig>().lambda().eq(SysAppConfig::getAreaCode,comActVO.getAreaCode())); |
| | | // if(sysAppConfig!=null){ |
| | | // loginUserInfoVO.setAppId(sysAppConfig.getAppId()); |
| | | // loginUserInfoVO.setAppSecret(sysAppConfig.getSecret()); |
| | | // } |
| | | } |
| | | } |
| | | List<SysRoleDO> roleDOList = roleDAO.selectByUserId(sysUserDO.getUserId()); |
| | |
| | | * @return 协议内容 |
| | | */ |
| | | @Override |
| | | public R userAgreement(int type) { |
| | | public R userAgreement(int type,String appId) { |
| | | SysUserAgreementDO sysUserAgreementDO = sysUserAgreementDAO |
| | | .selectOne(new QueryWrapper<SysUserAgreementDO>().lambda().eq(SysUserAgreementDO::getType, type)); |
| | | .selectOne(new QueryWrapper<SysUserAgreementDO>().lambda().eq(SysUserAgreementDO::getType, type).eq(SysUserAgreementDO::getAppId,appId)); |
| | | return R.ok(sysUserAgreementDO); |
| | | } |
| | | |
| | |
| | | for (UserProportion userProportion : userProportions) { |
| | | if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(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()); |
| | | userRateAnalysisVOList.add(vo); |
| | | } |
| | | } |
| | | } |
| | | //计算其他用户占比 |
| | | final Boolean flag=(type.equals(ALLSTREET) || type.equals(ALLCOMMUNITY) || type.equals(BYSTREET) || type.equals(BYAREA)); |
| | | if (flag){ |
| | | UserRateAnalysisVO vo=new UserRateAnalysisVO(); |
| | | vo.setName(OTHERUSER); |
| | | vo.setCount(analysisVO.getAllUser()-countUser(userRateAnalysisVOList)); |
| | | vo.setRate(getRate(analysisVO.getAllUser(), vo.getCount())); |
| | | userRateAnalysisVOList.add(vo); |
| | | if (ObjectUtils.isEmpty(range)){ |
| | | //查看累计数据时才计算其他用户的比例 || type.equals(BYSTREET) || type.equals(BYAREA)) |
| | | final Boolean flag=(type.equals(ALLSTREET) || type.equals(ALLCOMMUNITY)); |
| | | if (flag){ |
| | | UserRateAnalysisVO vo=new UserRateAnalysisVO(); |
| | | vo.setName(OTHERUSER); |
| | | vo.setCount(analysisVO.getAllUser()-countUser(userRateAnalysisVOList)); |
| | | vo.setRate(getRate(analysisVO.getAllUser(), vo.getCount())); |
| | | userRateAnalysisVOList.add(vo); |
| | | } |
| | | } |
| | | //计算其他用户占比 |
| | | UserRateVO userRate=new UserRateVO(); |
| | | userRate.setUserList(userRateAnalysisVOList); |
| | | return R.ok(userRate); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R realUser(Integer type, Long streetId, Long areaCode, Integer range) { |
| | |
| | | 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)); |
| | |
| | | realUserVO.setRealUserList(realUserList); |
| | | //使用索引迭代避免从列表移除数据后出现空指针异常 |
| | | if (type.equals(BYSTREET) || type.equals(ALLCOMMUNITY)){ |
| | | for (int i = 0; i <= realUserList.size() ; i++) { |
| | | for (int i = 0; i < realUserList.size() ; i++) { |
| | | RealUserAnalysisVO realUserAnalysisVO = realUserList.get(i); |
| | | if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(realUserAnalysisVO)){ |
| | | if (StringUtils.isNotEmpty(realUserAnalysisVO.getName())){ |
| | | if (realUserAnalysisVO.getName().equals("请选择社区")){ |
| | | realUserList.remove(realUserAnalysisVO); |
| | | realUserList.remove(i); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }else { |
| | | //只保留十条 |
| | | realUserList.remove(10); |
| | | if (realUserList.size()>=11){ |
| | | realUserList.remove(10); |
| | | } |
| | | } |
| | | return R.ok(realUserVO); |
| | | } |
| | |
| | | vo.setActiveUserY(activeY); |
| | | return R.ok(vo); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R uuPush(String washPhone,String phone,String washName,Integer orderStatus) { |
| | |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Override |
| | | public R getAreaAndStreet() { |
| | | List<Integer> areaCodeList=areaCodeList(); |
| | |
| | | } |
| | | return R.ok(areaVOList); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取最近20天数据 |
| | |
| | | break; |
| | | case "510402": |
| | | name="东区"; |
| | | break; |
| | | case "510411": |
| | | name="仁和区"; |
| | | break; |
| | |
| | | *根据type选择要设置的名称 |
| | | * */ |
| | | private String typeToName(Integer type,UserProportion proportion){ |
| | | log.info("当前code"+proportion.getAreaCode()); |
| | | String name=""; |
| | | if (type.equals(ALLCOUNTY)){ |
| | | name=areaCodeToName(proportion.getAreaCode()); |