⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 statvarsservice.java

📁 论坛软件系统亦称电子公告板(BBS)系统
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
			newstatvars.add("'forumsrank', 'forums', '"+tempI+"'");
		}
		
		tempS = statvars.get("forums");
		if(tempS == null || tempS.equals("") || tempS.equals("0")){
			statvars.put("forums", "20");
		}
		
		tempS = statvars.get("posts");
		if(tempS!=null){
			posts = dataParse.characterParse(tempS, false);
		}else{
			tempML = dataBaseDao.executeQuery("SELECT fid, name, posts FROM "+tableprefix+"forums WHERE status>0 AND type<>'group' ORDER BY posts DESC LIMIT 0, "+statvars.get("forums"));
			if(tempML!=null){
				tempI = 0;
				posts = new HashMap<Integer, Map<String,String>>();
				for(Map<String,String> tempM : tempML){
					posts.put(tempI, tempM);
					tempI++;
				}
			}
			newstatvars.add("'forumsrank', 'posts', '"+dataParse.combinationChar(posts)+"'");
		}
		
		tempS = statvars.get("thismonth");
		if(tempS != null){
			thismonth = dataParse.characterParse(tempS, false);
		}else{
			tempML = dataBaseDao.executeQuery("SELECT DISTINCT(p.fid) AS fid, f.name, COUNT(pid) AS posts FROM "+tableprefix+"posts p " +
					"LEFT JOIN "+tableprefix+"forums f USING (fid) " +
					"WHERE dateline>='"+timestamp+"'-86400*30 AND invisible='0' AND authorid>'0' " +
					"GROUP BY p.fid ORDER BY posts DESC LIMIT 0, "+statvars.get("forums"));
			if(tempML!=null){
				tempI = 0;
				thismonth = new HashMap<Integer, Map<String,String>>();
				for(Map<String,String> tempM : tempML){
					thismonth.put(tempI, tempM);
					tempI++;
				}
			}
			newstatvars.add("'forumsrank', 'thismonth', '"+dataParse.combinationChar(thismonth)+"'");
		}
		
		tempS = statvars.get("today");
		if(tempS != null){
			today = dataParse.characterParse(tempS, false);
		}else{
			tempML = dataBaseDao.executeQuery("SELECT DISTINCT(p.fid) AS fid, f.name, COUNT(pid) AS posts FROM "+tableprefix+"posts p " +
					"LEFT JOIN "+tableprefix+"forums f USING (fid) " +
					"WHERE dateline>='"+timestamp+"'-86400 AND invisible='0' AND authorid>'0' " +
					"GROUP BY p.fid ORDER BY posts DESC LIMIT 0, "+statvars.get("forums"));
			if(tempML!=null){
				tempI = 0;
				today = new HashMap<Integer, Map<String,String>>();
				for(Map<String,String> tempM : tempML){
					today.put(tempI, tempM);
					tempI++;
				}
			}
			newstatvars.add("'forumsrank', 'today', '"+dataParse.combinationChar(today)+"'");
		}
		
		Stats_forumsrankVO stats_forumsrankVO = new Stats_forumsrankVO();
		
		stats_forumsrankVO.setForumCompositorMapList(threads , posts, thismonth, today);
		
		tempI = Integer.parseInt(statvars.get("lastupdate"));
		dateFormat.applyPattern("yyyy-MM-dd HH:mm");
		stats_forumsrankVO.setLastTime(Common.gmdate(dateFormat, tempI, timeoffset));
		stats_forumsrankVO.setNextTime(Common.gmdate(dateFormat, (tempI+statscachelife.intValue()), timeoffset));
		setNavbarVO(stats_forumsrankVO.getNavbar(), statstatus, modworkstatus, "forumsrank");
		
		updateNewStatvars(newstatvars, dataBaseDao);
		return stats_forumsrankVO;
	}
	public Stats_viewsVO getFinalStats_viewsVO(Map<String,String> settingMap){
		
		String tempS = settingMap.get("statstatus");
		boolean statstatus = tempS!=null && !tempS.equals("") && !tempS.equals("0");
		tempS = settingMap.get("modworkstatus");
		boolean modworkstatus = tempS!=null && !tempS.equals("") && !tempS.equals("0");
		
		DataBaseDao dataBaseDao=((DataBaseDao)BeanFactory.getBean("dataBaseDao"));
		List<Map<String,String>> totalResultML = dataBaseDao.executeQuery("SELECT st.count FROM "+tableprefix+"stats AS st WHERE st.type='total' AND st.variable='hits'");
		float total_count = 0;
		if(totalResultML.size()>0){
			total_count = Float.parseFloat(totalResultML.get(0).get("count"));
		}
		
		
		List<Map<String,String>> tempML = dataBaseDao.executeQuery("SELECT * FROM "+tableprefix+"stats AS st WHERE st.type='week' OR st.type='hour'");
		dataBaseDao = null;
		
		List<Map<String,String>> weekResultML = new ArrayList<Map<String,String>>();
		List<Map<String,String>> hourResultML = new ArrayList<Map<String,String>>();
		if(tempML!=null){
			for(Map<String,String> tempM : tempML){
				if(tempM!=null){
					if("hour".equals(tempM.get("type"))){
						hourResultML.add(tempM);
					}else{
						weekResultML.add(tempM);
					}
				}
			}
		}
		tempML = null;
		
		Stats_viewsVO stats_viewsVO = new Stats_viewsVO();
		List<PageInfo> pageInfo_week = stats_viewsVO.getPageInfoWeekList();
		
		String[] weekTime = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
		String[] hourTime = {"0 AM","1 AM","2 AM","3 AM","4 AM","5 AM","6 AM",
							 "7 AM","8 AM","9 AM","10 AM","11 AM","12 AM","1 PM",
							 "2 PM","3 PM","4 PM","5 PM","6 PM","7 PM","8 PM",
							 "9 PM","10 PM","11 PM"};
		
		Map<String,String> mapTemp2 = null;
		float maxPercent_week = 0F;
		int foreachSize = weekResultML.size();
		PageInfo pageInfo = null;
		for(int i = 0;i<foreachSize;i++){
			if(i==0){
				float tempD = 0F;
				for(Map<String,String> mapTemp : weekResultML){
					tempD = Float.parseFloat(mapTemp.get("count"));
					maxPercent_week = tempD>maxPercent_week?tempD:maxPercent_week;
				}
				maxPercent_week = Float.valueOf(number_format(total_count, maxPercent_week));
			}
			mapTemp2 = weekResultML.get(i);
			pageInfo = new PageInfo();
			pageInfo.setNum(mapTemp2.get("count"));
			pageInfo.setNumPercent(number_format(total_count, Float.parseFloat(mapTemp2.get("count"))));
			pageInfo.setInformation(weekTime[Integer.parseInt(mapTemp2.get("variable"))]);
			setPageInfoMaxLengh(maxPercent_week, pageInfo);
			pageInfo_week.add(pageInfo);
		}
		pageInfo_week = null;
		weekResultML = null;
		
		List<PageInfo> pageInfo_hour = stats_viewsVO.getPageInfoHourList();
		float maxPercent_hour = 0F;
		foreachSize = hourResultML.size();
		for(int i = 0;i<foreachSize;i++){
			if(i==0){
				float tempD = 0F;
				for(Map<String,String> mapTemp : hourResultML){
					tempD = Float.parseFloat(mapTemp.get("count"));
					maxPercent_hour = tempD>maxPercent_hour?tempD:maxPercent_hour;
				}
				maxPercent_hour = Float.valueOf(number_format(total_count, maxPercent_hour));
			}
			mapTemp2 = hourResultML.get(i);
			pageInfo = new PageInfo();
			pageInfo.setNum(mapTemp2.get("count"));
			pageInfo.setNumPercent(number_format(total_count, Float.parseFloat(mapTemp2.get("count"))));
			pageInfo.setInformation(hourTime[Integer.parseInt(mapTemp2.get("variable"))]);
			setPageInfoMaxLengh(maxPercent_hour, pageInfo);
			pageInfo_hour.add(pageInfo);
		}
		mapTemp2 = null;
		pageInfo_hour = null;
		hourResultML = null;
		pageInfo = null;
		
		setNavbarVO(stats_viewsVO.getNavbar(), statstatus, modworkstatus, "views");
		return stats_viewsVO;
	}
	public Stats_agentVO getFinalStats_agentVO(Map<String,String> settingMap){
		String tempS = settingMap.get("statstatus");
		boolean statstatus = tempS!=null && !tempS.equals("") && !tempS.equals("0");
		tempS = settingMap.get("modworkstatus");
		boolean modworkstatus = tempS!=null && !tempS.equals("") && !tempS.equals("0");
		
		DataBaseDao dataBaseDao=((DataBaseDao)BeanFactory.getBean("dataBaseDao"));
		List<Map<String,String>> tempML = dataBaseDao.executeQuery("SELECT * FROM "+tableprefix+"stats AS st WHERE st.type='os' OR st.type='browser'");
		dataBaseDao = null;
		
		List<Map<String,String>> osResultML = new ArrayList<Map<String,String>>();
		List<Map<String,String>> browserResultML = new ArrayList<Map<String,String>>();
		if(tempML!=null){
			for(Map<String,String> tempM : tempML){
				if(tempM!=null){
					if("os".equals(tempM.get("type"))){
						osResultML.add(tempM);
					}else{
						browserResultML.add(tempM);
					}
				}
			}
		}
		tempML = null;
		
		Stats_agentVO stats_agentVO = new Stats_agentVO();
		List<PageInfoWithImage> operatingSystemList = stats_agentVO.getOperatingSystemList();
		
		PageInfoWithImage pageInfoWithImage = null;
		Map<String,String> tempMap = null;
		
		float numPercent_system = 0F;
		float maxPercent = 0F;
		float tempD = 0F;
		for(int i = 0;i<osResultML.size();i++){
			if(i==0){
				for(Map<String,String> tempM : osResultML){
					tempD = Float.parseFloat(tempM.get("count"));
					numPercent_system += tempD;
					maxPercent = tempD>maxPercent?tempD:maxPercent;
				}
				maxPercent = Float.parseFloat(number_format(numPercent_system, maxPercent));
			}
			
			pageInfoWithImage = new PageInfoWithImage();
			tempMap = osResultML.get(i);
			pageInfoWithImage.setInformation(tempMap.get("variable"));
			pageInfoWithImage.setNum(tempMap.get("count"));
			pageInfoWithImage.setNumPercent(number_format(numPercent_system, Float.parseFloat(tempMap.get("count"))));
			setPageInfoMaxLengh(maxPercent, pageInfoWithImage);
			operatingSystemList.add(pageInfoWithImage);
		}
		operatingSystemList = null;
		
		List<PageInfoWithImage> browserList = stats_agentVO.getBrowserList();
		float numPercent_browser = 0F;
		float maxPercent_browser = 0F;
		for(int i = 0;i<browserResultML.size();i++){
			if(i==0){
				for(Map<String,String> tempM : browserResultML){
					tempD = Float.parseFloat(tempM.get("count"));
					numPercent_browser += tempD;
					maxPercent_browser = tempD>maxPercent_browser?tempD:maxPercent_browser;
				}
				maxPercent_browser = Float.parseFloat(number_format(numPercent_browser, maxPercent_browser));
			}
			pageInfoWithImage = new PageInfoWithImage();
			tempMap = browserResultML.get(i);
			pageInfoWithImage.setInformation(tempMap.get("variable"));
			pageInfoWithImage.setNum(tempMap.get("count"));
			pageInfoWithImage.setNumPercent(number_format(numPercent_browser, Float.parseFloat(tempMap.get("count"))));
			setPageInfoMaxLengh(maxPercent_browser, pageInfoWithImage);
			browserList.add(pageInfoWithImage);
		}
		pageInfoWithImage = null;
		tempMap = null;
		browserList = null;
		
		setNavbarVO(stats_agentVO.getNavbar(), statstatus, modworkstatus, "agent");
		
		return stats_agentVO;
	}
	public Stats_postsLogVO getFinalStats_postsLogVO(Map<String,String> settingMap,int timestamp,float timeoffset){
		
		String tempS = settingMap.get("statstatus");
		boolean statstatus = tempS!=null && !tempS.equals("") && !tempS.equals("0");
		tempS = settingMap.get("modworkstatus");
		boolean modworkstatus = tempS!=null && !tempS.equals("") && !tempS.equals("0");
		
		Stats_postsLogVO stats_postsLogVO = new Stats_postsLogVO();
		
		setNavbarVO(stats_postsLogVO.getNavbar(), statstatus, modworkstatus, "posts");
		
		List<String> newstatvars = new ArrayList<String>();
		DataBaseDao dataBaseDao = ((DataBaseDao)BeanFactory.getBean("dataBaseDao"));
		setSubPostlog(stats_postsLogVO.getSubPostLog(), newstatvars, dataBaseDao, new SimpleDateFormat(), timestamp, timeoffset);
		
		updateNewStatvars(newstatvars, dataBaseDao);
		return stats_postsLogVO;
	}
	public Stats_CompositorVO getFinalStats_threadCompositorVO(Map<String,String> settingMap){
		
		String tempS = settingMap.get("statstatus");
		boolean statstatus = tempS!=null && !tempS.equals("") && !tempS.equals("0");
		tempS = settingMap.get("modworkstatus");
		boolean modworkstatus = tempS!=null && !tempS.equals("") && !tempS.equals("0");
		
		DataBaseDao dataBaseDao = (DataBaseDao)BeanFactory.getBean("dataBaseDao");
		List<Map<String,String>> list_views = dataBaseDao.executeQuery("SELECT views, tid, subject FROM "+tableprefix+"threads WHERE displayorder>='0' ORDER BY views DESC LIMIT 0, 20");
		List<Map<String,String>> list_replies = dataBaseDao.executeQuery("SELECT replies, tid, subject FROM "+tableprefix+"threads WHERE displayorder>='0' ORDER BY replies DESC LIMIT 0, 20");
		dataBaseDao=null;
		
		Stats_CompositorVO stats_threadCompositorVO = new Stats_CompositorVO();
		List<Map<String,CompositorInfo>> threadCompositorMapList = stats_threadCompositorVO.getCompositorMapList();
		
		CompositorInfo threadInfo_views = null;
		Map<String,CompositorInfo> mapTemp_result = null;
		Map<String,String> tempMap_views = null;
		Map<String,String> tempMap_replies = null;
		CompositorInfo threadInfo_replies = null;
		for(int i = 0;i<list_views.size();i++){
			mapTemp_result = new HashMap<String, CompositorInfo>();
			tempMap_views = list_views.get(i);
			threadInfo_views = new CompositorInfo();
			threadInfo_views.setCompositorSign(tempMap_views.get("tid"));
			threadInfo_views.setCompositorName(tempMap_views.get("subject"));
			threadInfo_views.setCompositorNum(tempMap_views.get("views"));
			mapTemp_result.put("views", threadInfo_views);
			
			tempMap_replies = list_replies.get(i);
			threadInfo_replies = new CompositorInfo();
			threadInfo_replies.setCompositorSign(tempMap_replies.get("tid"));
			threadInfo_replies.setCompositorName(tempMap_replies.get("subject"));
			threadInfo_replies.setCompositorNum(tempMap_replies.get("replies"));
			mapTemp_result.put("replies", threadInfo_replies);
			
			threadCompositorMapList.add(mapTemp_result);
		}
		threadInfo_views = null;
		mapTemp_result = null;
		tempMap_views = null;
		tempMap_replies = null;
		threadInfo_replies = null;
		threadCompositorMapList = null;
		
		setNavbarVO(stats_threadCompositorVO.getNavbar(), statstatus, modworkstatus, "threadsrank");
		
		return stats_threadCompositorVO;
	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -