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

📄 topicadminactionservice.java

📁 论坛软件系统亦称电子公告板(BBS)系统
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
				Integer memberReply = members_reply.getPosts() - 1;
				members_reply.setPosts(memberReply<0?0:memberReply);
				if(updateCredit){
					postOperating.setMembersExtcredit(forumfields, (String) parameterMap.get("creditspolicy"), members_reply, updateField, postOperating.reply,false,1);
				}
				List<Ratelog> ratelogList = ((RatelogDao)BeanFactory.getBean("ratelogDao")).getRatelogByPid(posts_old.getPid());
				if (ratelogList != null) {
					for (int j = 0; j < ratelogList.size(); j++) {
						Ratelog ratelog = ratelogList.get(j);
						RatelogId ratelogId = ratelog.getId();
						Byte extcredit = ratelogId.getExtcredits();
						Short score = ratelogId.getScore();
						if(score>0){
							postOperating.setMembersExtcredit(extcredit+"", members_reply, score.intValue(), false);
						}
						updateField.put("extcredits" + extcredit, "extcredits" + extcredit);
					}
				}
				operatingAttachment(posts_old.getPid(), attachurl_realy, forumfields,parameterMap, members_reply, updateField,true,updateCredit);
				postOperating.setCredits((String) parameterMap.get("creditsformula"),members_reply, updateField);
				((MembersDao)BeanFactory.getBean("memberDao")).modifyMember(members_reply);
			}
		}
		
		List<Map<String,String>> tempML = dataBaseDao.executeQuery("SELECT name FROM "+tableprefix+"forums WHERE fid="+threads.getFid());
		String currentForumName = tempML!=null&&tempML.size()>0?tempML.get(0).get("name"):"";
		int timestamp = Common.time();
		writeLog(parameterMap,currentForumName, threads.getSubject(),threads.getTid()+"", operationE,timestamp);
		sendMessageToAuthor_(parameterMap,currentForumName, (String)parameterMap.get("url"), operationE, tempList,(Float)parameterMap.get("timeoffset"));
		deleteRatelog(postsIdList);
		deleteMyposts(postsIdList);
		deleteAttachments(postsIdList);
		if(threads.getSpecial()!=0){
			deleteTrades(postsIdList);
		}
		Common.updatemodworks((Map<String,String>)parameterMap.get("settingMap"), (Integer)parameterMap.get("uid"), timestamp, operationE, (short)tempList.size());
		postsDao = null;
		return null;
	}
	private void setTopicPublicVO(TopicPublicVO topicPublicVO,Forums currentForum,Threads currentThread,String reasonpm,String[] modreasonsArray){
		if(currentForum.getType().equals("sub")){
			Forums superForums = ((ForumsDao)BeanFactory.getBean("forumsDao")).findById(currentForum.getFup());
			
			topicPublicVO.setBeingSupperForum(true);
			topicPublicVO.setSupperFid(superForums.getFid().toString());
			topicPublicVO.setSupperForumName(superForums.getName());
		}
		
		topicPublicVO.setFid(currentForum.getFid().toString());
		topicPublicVO.setForumName(currentForum.getName());
		topicPublicVO.setTopicId(currentThread.getTid().toString());
		topicPublicVO.setTopicName(currentThread.getSubject());
		
		if(reasonpm.equals("1")){
			topicPublicVO.setNecesseryInfo(true);
		}else if(reasonpm.equals("2")){
			topicPublicVO.setNecessaryToSendMessage(true);
		}else if(reasonpm.equals("3")){
			topicPublicVO.setNecesseryInfo(true);
			topicPublicVO.setNecessaryToSendMessage(true);
		}
		List<String> reasonList = topicPublicVO.getReasonList();
		for(String modreasons : modreasonsArray){
			reasonList.add(modreasons);
		}
	}
	public String operating(String operation,Map<String,Object> parameterMap){
		boolean bool = true;
		String result = null;
		try {
			Method method = this.getClass().getDeclaredMethod("operating_"+operation,Map.class);
			method.setAccessible(true);
			try {
				result = (String)method.invoke(this,parameterMap);
			} catch (IllegalArgumentException e) {
				e.printStackTrace();
				bool = false;
			} catch (IllegalAccessException e) {
				e.printStackTrace();
				bool = false;
			} catch (InvocationTargetException e) {
				e.printStackTrace();
				bool = false;
			}
		} catch (SecurityException e) {
			e.printStackTrace();
			bool = false;
		} catch (NoSuchMethodException e) {
			e.printStackTrace();
			bool = false;
		}
		if(bool){
			return result;
		}else{
			return "请稍后再试";
		}
	}
	private String operating_deleteMirrorImage(Map<String,Object> parameterMap){
		if (parameterMap.get("moderate_") == null) {
			return "对不起,您没有选择主题或者无法操作特殊主题,请返回修改。";
		}
		DataBaseDao dataBaseDao = ((DataBaseDao)BeanFactory.getBean("dataBaseDao"));
		List<Threads> threadsList = getThreadsList((String[])parameterMap.get("moderate_"));
		List<Threadsmod> threadsmodList = new ArrayList<Threadsmod>();

		Forums forums = null;
		Short fid = Short.valueOf((String) parameterMap.get("fid"));
		if (fid == null && threadsList.size() > 0) {
			fid = threadsList.get(0).getFid();
		}
		ForumsDao forumsDao = ((ForumsDao)BeanFactory.getBean("forumsDao"));
		if (fid != null) {
			forums = forumsDao.findById(fid);
		}
		if (forums == null) {
			return "错误--03--forums IS NULL";
		}
		byte invisble = forums.getRecyclebin();
		String currentForumName = forums.getName();
		String operationE = "DEL";
		int timestamp = Common.time();
		List<Integer> deleteThreadsList = new ArrayList<Integer>();
		for (Threads threads_old : threadsList) {

			Integer tid = threads_old.getTid();
			deleteThreadsList.add(tid);
			if (invisble != 0) {
				Threadsmod threadsmod = new Threadsmod();
				ThreadsmodId threadsmodId = new ThreadsmodId();
				threadsmodId.setAction(operationE);
				threadsmodId.setDateline(timestamp);
				threadsmodId.setExpiration(0);
				threadsmodId.setMagicid((short) 0);
				threadsmodId.setStatus((byte) 1);
				threadsmodId.setTid(tid);
				threadsmodId.setUid((Integer) parameterMap.get("uid"));
				threadsmodId.setUsername((String) parameterMap
						.get("username"));
				threadsmod.setId(threadsmodId);
				threadsmodList.add(threadsmod);
			}
			writeLog(parameterMap,currentForumName, threads_old.getSubject(), threads_old
					.getTid()
					+ "", operationE,timestamp);
		}
		
		if(deleteThreadsList.size()>0){
			if (invisble == 0) {
				StringBuffer sql = new StringBuffer("DELETE FROM "+tableprefix+"threads WHERE tid IN(");
				for(Integer tid : deleteThreadsList){
					sql.append(tid+",");
				}
				int sqlL = sql.length();
				sql.replace(sqlL-1, sqlL, ")");
				dataBaseDao.executeDelete(sql.toString());
			} else {
				StringBuffer sqlBuffer = new StringBuffer("UPDATE "+tableprefix+"threads AS t SET t.displayorder=-1 , t.moderated=1 WHERE t.tid IN(");
				for(Integer tid : deleteThreadsList){
					sqlBuffer.append(tid+",");
				}
				int sqlBufferL = sqlBuffer.length();
				sqlBuffer.replace(sqlBufferL-1, sqlBufferL, ")");
				dataBaseDao.execute(sqlBuffer.toString());
			}
		}
		sendMessageToAuthor(parameterMap,currentForumName, (String)parameterMap.get("url"), operationE, threadsList,(Float)parameterMap.get("timeoffset"));
		if (threadsmodList.size() > 0) {
			((ThreadsmodDao)BeanFactory.getBean("threadsmodDao")).saveList(threadsmodList);
		}
		threadsmodList = null;
		updateForumCount(fid, dataBaseDao);
		forumsDao = null;
		forums  = null;
		Common.updatemodworks((Map<String,String>)parameterMap.get("settingMap"), (Integer) parameterMap.get("uid"), timestamp, operationE, (short) threadsList.size());

		operationE = null;
		return null;
	}
	private String operating_recommend(Map<String,Object> parameterMap){
		String[] moderate_ = (String[])parameterMap.get("moderate_");
		if(moderate_==null){
			return "对不起,您没有选择主题或者无法操作特殊主题,请返回修改。..";
		}
		String isRecommend = (String)parameterMap.get("isRecommend");
		DataBaseDao dataBaseDao = ((DataBaseDao)BeanFactory.getBean("dataBaseDao"));
		String fid = (String)parameterMap.get("fid");
		String currentForumName = dataBaseDao.executeQuery("SELECT name FROM "+tableprefix+"forums WHERE fid="+fid).get(0).get("name");
		String operationE = null;
		
		
		
		if(isRecommend.equals("1")){
			operationE = "REC";
		}else{
			operationE = "URE";
			List<Integer> tidList = new ArrayList<Integer>();
			for(String moderate : moderate_){
				tidList.add(Integer.valueOf(moderate));
			}
			((ForumRecommendDao)BeanFactory.getBean("forumRecommendDao")).deleteForumrecommend(tidList);
		}
		List<Threads> threadsList = getThreadsList(moderate_);
		List<Threadsmod> threadsmodList = new ArrayList<Threadsmod>();
		List<Forumrecommend> forumrecommendList = new ArrayList<Forumrecommend>();
		
		int timestamp = Common.time();
		StringBuffer updateThreadIdL = new StringBuffer();
		StringBuffer updateThreadsmod = new StringBuffer();
		for(Threads threads_old : threadsList){
			Integer tid = threads_old.getTid();
			if(isRecommend.equals("1")){
				updateThreadIdL.append(tid+",");
				Forumrecommend forumrecommend = new Forumrecommend();
				forumrecommend.setAuthor(threads_old.getAuthor());
				forumrecommend.setAuthorid(threads_old.getAuthorid());
				forumrecommend.setDisplayorder((byte)0);
				forumrecommend.setExpiration(timestamp+Integer.parseInt((String)parameterMap.get("recommendExpire")));
				forumrecommend.setFid(Short.valueOf(fid));
				forumrecommend.setModeratorid((Integer)parameterMap.get("uid"));
				forumrecommend.setTid(threads_old.getTid());
				forumrecommend.setSubject(threads_old.getSubject());
				forumrecommendList.add(forumrecommend);
			}
			
			
			Threadsmod threadsmod = new Threadsmod();
			ThreadsmodId threadsmodId = new ThreadsmodId();
			threadsmodId.setAction(operationE);
			threadsmodId.setDateline(timestamp);
			threadsmodId.setExpiration(0);
			threadsmodId.setMagicid((short)0);
			threadsmodId.setStatus((byte)1);
			threadsmodId.setTid(tid);
			threadsmodId.setUid((Integer)parameterMap.get("uid"));
			threadsmodId.setUsername((String)parameterMap.get("username"));
			threadsmod.setId(threadsmodId);
			threadsmodList.add(threadsmod);
			updateThreadsmod.append(tid+",");
			
			writeLog(parameterMap,currentForumName, threads_old.getSubject(),tid+"", operationE,timestamp);
		}
		
		if(updateThreadIdL.length()!=0){
			StringBuffer sqlBuffer = new StringBuffer("UPDATE "+tableprefix+"threads AS t SET t.moderated=1 WHERE t.tid IN(");
			sqlBuffer.append(updateThreadIdL);
			int sqlBufferL = sqlBuffer.length();
			sqlBuffer.replace(sqlBufferL-1, sqlBufferL, ")");
			dataBaseDao.execute(sqlBuffer.toString());
			sqlBuffer = null;
		}
		updateThreadIdL = null;
		if(updateThreadsmod.length()!=0){
			StringBuffer sqlBuffer = new StringBuffer("UPDATE "+tableprefix+"threadsmod SET status=0 WHERE tid IN(");
			sqlBuffer.append(updateThreadsmod);
			int sqlBufferL = sqlBuffer.length();
			sqlBuffer.replace(sqlBufferL-1, sqlBufferL, ")");
			sqlBuffer.append(" AND action='REC' AND status=1");
			dataBaseDao.execute(sqlBuffer.toString());
			sqlBuffer = null;
		}
		updateThreadsmod = null;
		dataBaseDao = null;
		sendMessageToAuthor(parameterMap,currentForumName, (String)parameterMap.get("url"), operationE, threadsList,(Float)parameterMap.get("timeoffset"));
		((ThreadsmodDao)BeanFactory.getBean("threadsmodDao")).saveList(threadsmodList);
		threadsmodList = null;
		Common.updatemodworks((Map<String,String>)parameterMap.get("settingMap"), (Integer)parameterMap.get("uid"), timestamp, operationE, (short)threadsList.size());
		operationE = null;
		threadsList = null;
		if(forumrecommendList.size()>0){
			((ForumRecommendDao)BeanFactory.getBean("forumRecommendDao")).addForumrecommend(forumrecommendList);
		}
		forumrecommendList = null;
		return null;
	}
	private String operating_type(Map<String,Object> parameterMap){
		String[] moderate_ = (String[])parameterMap.get("moderate_");
		if(moderate_==null){
			return "对不起,您没有选择主题或者无法操作特殊主题,请返回修改。";
		}
		DataBaseDao dataBaseDao = ((DataBaseDao)BeanFactory.getBean("dataBaseDao"));
		String fid = (String)parameterMap.get("fid");
		String currentForumName = dataBaseDao.executeQuery("SELECT name FROM "+tableprefix+"forums WHERE fid="+fid).get(0).get("name");
		String operationE = "TYP";
		
		List<Threads> threadsList = getThreadsList(moderate_);
		List<Threadsmod> threadsmodList = new ArrayList<Threadsmod>();
		int timestamp = Common.time();
		

⌨️ 快捷键说明

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