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

📄 statvarsservice.java

📁 论坛软件系统亦称电子公告板(BBS)系统
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
	public Stats_CompositorVO getFinalStats_postsCompositorVO(Map<String,String> settingMap,int timestamp){

		Double statscachelife = Double.valueOf(settingMap.get("statscachelife"));
		statscachelife = statscachelife * 60;
		String tempS = settingMap.get("statstatus");
		boolean statstatus = tempS!=null && !tempS.equals("0")&& !tempS.equals("");
		tempS = settingMap.get("modworkstatus");
		boolean modworkstatus = tempS!=null && !tempS.equals("") && !tempS.equals("0");
		DataBaseDao dataBaseDao = (DataBaseDao)BeanFactory.getBean("dataBaseDao");
		
		Map<String,String> statvars = getFinalMap("postsrank",dataBaseDao);
		tempS = statvars.get("lastupdate");
		int lastupdate = tempS == null ? 0 : Integer.parseInt(tempS);
		List<String> newstatvars = new ArrayList<String>();
		
		if(timestamp - lastupdate > statscachelife){
			statvars.clear();
			statvars.put("lastupdate", timestamp+"");
			newstatvars.add("'postsrank', 'lastupdate', '"+timestamp+"'");
		}
		
		Map<Integer,Map<String,String>> posts = null;
		Map<Integer,Map<String,String>> digestposts = null;
		Map<Integer,Map<String,String>> thismonth = null;
		Map<Integer,Map<String,String>> today = null;
		DataParse dataParse = ((DataParse)BeanFactory.getBean("dataParse"));
		List<Map<String,String>> tempML = null;
		int tempI = 0;
		
		tempS = statvars.get("posts");
		if(tempS != null){
			posts = dataParse.characterParse(tempS, false);
		}else{
			tempML = dataBaseDao.executeQuery("SELECT username, uid, posts FROM "+tableprefix+"members ORDER BY posts DESC LIMIT 0, 20");
			if(tempML != null){
				posts = new HashMap<Integer, Map<String,String>>();
				for(Map<String,String> tempM : tempML){
					posts.put(tempI++, tempM);
				}
			}
			newstatvars.add("'postsrank', 'posts', '"+dataParse.combinationChar(posts)+"'");
		}
		
		tempI = 0;
		tempS = statvars.get("digestposts");
		if(tempS != null){
			digestposts = dataParse.characterParse(tempS, false);
		}else{
			tempML = dataBaseDao.executeQuery("SELECT username, uid, digestposts FROM "+tableprefix+"members ORDER BY digestposts DESC LIMIT 0, 20");
			if(tempML != null){
				digestposts = new HashMap<Integer, Map<String,String>>();
				for(Map<String,String> tempM : tempML){
					digestposts.put(tempI++, tempM);
				}
			}
			newstatvars.add("'postsrank', 'digestposts', '"+dataParse.combinationChar(digestposts)+"'");
		}
		
		tempI = 0;
		tempS = statvars.get("thismonth");
		if(tempS != null){
			thismonth = dataParse.characterParse(tempS, false);
		}else{
			tempML = dataBaseDao.executeQuery("SELECT DISTINCT(author) AS username, COUNT(pid) AS posts " +
					"FROM "+tableprefix+"posts WHERE dateline>='"+timestamp+"'-86400*30 AND invisible='0' AND authorid>'0' " +
					"GROUP BY author ORDER BY posts DESC LIMIT 0, 20");
			if(tempML != null){
				thismonth = new HashMap<Integer, Map<String,String>>();
				for(Map<String,String> tempM : tempML){
					thismonth.put(tempI++, tempM);
				}
			}
			newstatvars.add("'postsrank', 'thismonth', '"+dataParse.combinationChar(thismonth)+"'");
		}
		
		tempI = 0;
		tempS = statvars.get("today");
		if(tempS != null){
			today = dataParse.characterParse(tempS, false);
		}else{
			tempML = dataBaseDao.executeQuery("SELECT DISTINCT(author) AS username, COUNT(pid) AS posts " +
					"FROM "+tableprefix+"posts WHERE dateline >='"+timestamp+"'-86400 AND invisible='0' AND authorid>'0' " +
					"GROUP BY author ORDER BY posts DESC LIMIT 0, 20");
			if(tempML != null){
				today = new HashMap<Integer, Map<String,String>>();
				for(Map<String,String> tempM : tempML){
					today.put(tempI++, tempM);
				}
			}
			newstatvars.add("'postsrank', 'today', '"+dataParse.combinationChar(today)+"'");
		}
		

		Stats_CompositorVO stats_CompositorVO = new Stats_CompositorVO();
		List<Map<String,CompositorInfo>> compositorMapList = stats_CompositorVO.getCompositorMapList();
		
		
		Map<String,CompositorInfo> mapResult = null;
		Map<String,String> stringMapTemp_posts = null;
		Map<String,String> stringMapTemp_digestposts = null;
		Map<String,String> stringMapTemp_thismonth = null;
		Map<String,String> stringMapTemp_today = null;
		CompositorInfo compositorInfo = null;
		for(int i = 0;i<posts.size();i++){
			mapResult = new HashMap<String, CompositorInfo>();
			
			stringMapTemp_posts = posts.get(i);
			compositorInfo = new CompositorInfo();
			compositorInfo.setCompositorName(stringMapTemp_posts.get("username"));
			compositorInfo.setCompositorNum(stringMapTemp_posts.get("posts"));
			compositorInfo.setCompositorSign(stringMapTemp_posts.get("uid"));
			mapResult.put("allPosts", compositorInfo);
			
			stringMapTemp_digestposts = digestposts.get(i);
			if(stringMapTemp_digestposts!=null){
				compositorInfo = new CompositorInfo();
				compositorInfo.setCompositorName(stringMapTemp_digestposts.get("username"));
				compositorInfo.setCompositorNum(stringMapTemp_digestposts.get("digestposts"));
				compositorInfo.setCompositorSign(stringMapTemp_digestposts.get("uid"));
				mapResult.put("prime", compositorInfo);
			}
			
			stringMapTemp_thismonth = thismonth.get(i);
			if(stringMapTemp_thismonth!=null){
				compositorInfo = new CompositorInfo();
				compositorInfo.setCompositorName(stringMapTemp_thismonth.get("username"));
				compositorInfo.setCompositorNum(stringMapTemp_thismonth.get("posts"));
				mapResult.put("dayOf30", compositorInfo);
			}
			
			stringMapTemp_today = today.get(i);
			if(stringMapTemp_today!=null){
				compositorInfo = new CompositorInfo();
				compositorInfo.setCompositorName(stringMapTemp_today.get("username"));
				compositorInfo.setCompositorNum(stringMapTemp_today.get("posts"));
				mapResult.put("hourOf24", compositorInfo);
			}
			compositorMapList.add(mapResult);
		}
		mapResult = null;
		stringMapTemp_posts = null;
		stringMapTemp_digestposts = null;
		stringMapTemp_thismonth = null;
		stringMapTemp_today = null;
		compositorInfo = null;
		compositorMapList = null;
		
		setNavbarVO(stats_CompositorVO.getNavbar(), statstatus, modworkstatus, "postsrank");
		updateNewStatvars(newstatvars, dataBaseDao);
		return stats_CompositorVO;
	}
	public Stats_creditComposidorVO getFinalStats_creditCompositorVO(Map<String,String> settingMap,int timestamp){
		
		Double statscachelife = Double.valueOf(settingMap.get("statscachelife"));
		statscachelife = statscachelife * 60;
		String tempS = settingMap.get("statstatus");
		boolean statstatus = tempS!=null && !tempS.equals("0")&& !tempS.equals("");
		tempS = settingMap.get("modworkstatus");
		boolean modworkstatus = tempS!=null && !tempS.equals("") && !tempS.equals("0");
		DataBaseDao dataBaseDao = (DataBaseDao)BeanFactory.getBean("dataBaseDao");
		
		Map<String,String> statvars = getFinalMap("creditsrank",dataBaseDao);
		tempS = statvars.get("lastupdate");
		int lastupdate = tempS == null ? 0 : Integer.parseInt(tempS);
		List<String> newstatvars = new ArrayList<String>();
		
		if(timestamp - lastupdate > statscachelife){
			statvars.clear();
			statvars.put("lastupdate", timestamp+"");
			newstatvars.add("'postsrank', 'lastupdate', '"+timestamp+"'");
		}
		
		Map<Integer,Map<String,String>> credits = null;
		Map<Integer,Map<Integer,Map<String,String>>> extendedcredits = null;
		List<Map<String,String>> tempML = null;
		int tempI = 0;
		DataParse dataParse = ((DataParse)BeanFactory.getBean("dataParse"));
		
		tempS = statvars.get("credits");
		if(tempS != null){
			credits = dataParse.characterParse(tempS, false);
		}else{
			tempML = dataBaseDao.executeQuery("SELECT username, uid, credits FROM "+tableprefix+"members ORDER BY credits DESC LIMIT 0, 20");
			if(tempML!=null){
				credits = new HashMap<Integer, Map<String,String>>();
				for(Map<String,String> tempM : tempML){
					credits.put(tempI++, tempM);
				}
			}
			newstatvars.add("'creditsrank', 'credits', '"+dataParse.combinationChar(credits)+"'");
		}
		
		Map<Integer,Map<String,Object>> extcredits = dataParse.characterParse(settingMap.get("extcredits"), false);
		tempS = statvars.get("extendedcredits");
		if(tempS != null){
			extendedcredits = dataParse.characterParse(tempS, false);
		}else{
			extendedcredits = new HashMap<Integer, Map<Integer,Map<String,String>>>();
			
			int id = 0;
			Map<Integer,Map<String,String>> tempM2 = null;
			for(Entry<Integer, Map<String,Object>> entry : extcredits.entrySet()){
				id = entry.getKey();
				tempI = 0;
				tempM2 = new HashMap<Integer, Map<String,String>>();
				
				tempML = dataBaseDao.executeQuery("SELECT username, uid, extcredits"+id+" AS credits FROM "+tableprefix+"members ORDER BY extcredits"+id+" DESC LIMIT 0, 20");
				if(tempML!=null){
					for(Map<String,String> tempM : tempML){
						tempM2.put(tempI++, tempM);
					}
				}
				extendedcredits.put(id, tempM2);
			}
			newstatvars.add("'creditsrank', 'extendedcredits', '"+dataParse.combinationChar(extendedcredits)+"'");
		}
		
		Stats_creditComposidorVO stats_creditComposidorVO = new Stats_creditComposidorVO();
		
		List<String> creditNameTopList = stats_creditComposidorVO.getCreditNameTopList();
		creditNameTopList.add("积分");
		List<String> creditNameDownList = stats_creditComposidorVO.getCreditNameDownList();
		
		List<Integer> integerTempListTop = new ArrayList<Integer>();
		Map<Integer,String> tempMapDown = new HashMap<Integer,String>();
		
		Integer extcreditsCount = extcredits.size();
		Integer nowExtcreditsCount = 0;
		for(Entry<Integer, Map<String,Object>> extcreditsEntry : extcredits.entrySet()){
			Integer key = extcreditsEntry.getKey();
			Map<String,Object> map = extcreditsEntry.getValue();
			nowExtcreditsCount++;
			if(extcreditsCount<5){
				integerTempListTop.add(key);
				creditNameTopList.add((String)map.get("title"));
			}else if(extcreditsCount==5){
				if(nowExtcreditsCount<3){
					integerTempListTop.add(key);
					creditNameTopList.add((String)map.get("title"));
				}else{
					tempMapDown.put(key, (String)map.get("title"));
					creditNameDownList.add((String)map.get("title"));
				}
			}else if(extcreditsCount>5&&extcreditsCount<8){
				if(nowExtcreditsCount<4){
					integerTempListTop.add(key);
					creditNameTopList.add((String)map.get("title"));
				}else{
					tempMapDown.put(key, (String)map.get("title"));
					creditNameDownList.add((String)map.get("title"));
				}
			}else{
				if(nowExtcreditsCount<5){
					integerTempListTop.add(key);
					creditNameTopList.add((String)map.get("title"));
				}else{
					tempMapDown.put(key, (String)map.get("title"));
					creditNameDownList.add((String)map.get("title"));
				}
			}
		}
		
		List<LineObject> lineObjectTopList = stats_creditComposidorVO.getLineObjectTopList();
		List<Map<String,Map<String,String>>> downMapList =  stats_creditComposidorVO.getDownMapList();
		

		for(int i = 0;i<credits.size();i++){
			Map<String,String> mapTempInI = credits.get(i);
			LineObject lineObject = stats_creditComposidorVO.new LineObject();
			List<CreditInfo> creditInfoList = lineObject.getCreditInfoList();

			CreditInfo creditInfo_credits = lineObject.new CreditInfo();
			creditInfo_credits.setCreditNum(mapTempInI.get("credits"));
			creditInfo_credits.setUsername(mapTempInI.get("username"));
			creditInfoList.add(creditInfo_credits);
			
			for(int j = 0;j<integerTempListTop.size();j++){
				Map<Integer,Map<String,String>> extendedcreditsMapIn = extendedcredits.get(integerTempListTop.get(j));
				
				CreditInfo creditInfo_extendedcredits = lineObject.new CreditInfo();
				Map<String,String> extendedcreditsMapIn2 = extendedcreditsMapIn.get(i);
				creditInfo_extendedcredits.setCreditNum(extendedcreditsMapIn2.get("credits"));
				creditInfo_extendedcredits.setUsername(extendedcreditsMapIn2.get("username"));
				creditInfoList.add(creditInfo_extendedcredits);
			}
			
			lineObjectTopList.add(lineObject);
			
			Map<String, Map<String,String>> mapTemp = new HashMap<String, Map<String,String>>();
			
			Iterator<Integer> iteratorTemp = tempMapDown.keySet().iterator();
			while(iteratorTemp.hasNext()){
				Integer mapKeyInteger = iteratorTemp.next();
				Map<Integer,Map<String,String>> extendedcreditsMapIn = extendedcredits.get(mapKeyInteger);
				Map<String,String> extendedcreditsMapIn2 = extendedcreditsMapIn.get(i);
				Map<String,String> resultMap = new HashMap<String, String>();
				resultMap.put("username", extendedcreditsMapIn2.get("username"));
				resultMap.put("creditNum",extendedcreditsMapIn2.get("credits"));
				mapTemp.put(tempMapDown.get(mapKeyInteger), resultMap);
			}
			
			downMapList.add(mapTemp);
		}
		
		setNavbarVO(stats_creditComposidorVO.getNavbar(), statstatus, modworkstatus, "creditsrank");
		updateNewStatvars(newstatvars, dataBaseDao);
		return stats_creditComposidorVO;
	}
	public Stats_onlineCompositorVO getFinalStats_onlineCompositorVO (Map<String,String> settingMap,int timestamp,float timeoffset){
		Double statscachelife = Double.valueOf(settingMap.get("statscachelife"));
		statscachelife = statscachelife * 60;
		String tempS = settingMap.get("statstatus");
		boolean statstatus = tempS!=null && !tempS.equals("0")&& !tempS.equals("");
		tempS = settingMap.get("modworkstatus");
		boolean modworkstatus = tempS!=null && !tempS.equals("") && !tempS.equals("0");
		DataBaseDao dataBaseDao = (DataBaseDao)BeanFactory.getBean("dataBaseDao");
		
		List<String> newstatvars = new ArrayList<String>();

⌨️ 快捷键说明

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