| | |
| | | } |
| | | |
| | | @Override |
| | | public R checkExport(String account, String password,String oldPassword) { |
| | | if(new BCryptPasswordEncoder().matches(password, oldPassword)){ |
| | | return R.ok(); |
| | | } |
| | | return R.fail(); |
| | | } |
| | | |
| | | @Override |
| | | public R newIndexData(Integer type, Long streetId) { |
| | | IndexDataKanbanVO indexDataKanbanVO = userDao.selectIndexDataKanban(null); |
| | | IndexDataAnalysisVO vo=new IndexDataAnalysisVO(); |
| | |
| | | vo.setActiveUserYMonth(activeUserYMonth); |
| | | if (type.equals(BYSTREET) || type.equals(ALLCOMMUNITY) || type.equals(ALLSTREET)){ |
| | | //获取其他用户 |
| | | vo.setOtherUser(indexDataKanbanVO.getAllUser()-vo.getAllUser()); |
| | | vo.setOtherUserRate(getRate(indexDataKanbanVO.getAllUser(),vo.getAllUser())); |
| | | vo.setOtherUser(indexDataKanbanVO.getAllUser()-countUser(vo.getUserProportionTotal())); |
| | | vo.setOtherUserRate(getRate(indexDataKanbanVO.getAllUser(),vo.getOtherUser())); |
| | | } |
| | | return R.ok(vo); |
| | | } |
| | |
| | | private Double getRate(Integer total,Integer count){ |
| | | if (0 != total && null != total){ |
| | | if (0 != count && null != count){ |
| | | BigDecimal div = NumberUtil.div(count.toString(), total.toString(),1); |
| | | BigDecimal div = NumberUtil.div(count.toString(), total.toString(),2); |
| | | return div.doubleValue(); |
| | | } |
| | | } |
| | |
| | | return count; |
| | | } |
| | | |
| | | /** |
| | | * 计算当前统计范围内的所有用户数 |
| | | * */ |
| | | public Integer countUser(List<UserProportion> list){ |
| | | Integer count=0; |
| | | if (list.size()>0){ |
| | | for (UserProportion proportion : list) { |
| | | if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(proportion)){ |
| | | if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(proportion.getUser())){ |
| | | count+=proportion.getUser(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return count; |
| | | } |
| | | |
| | | } |