getRemindInfo.jsp 19.6 KB
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ page import="weaver.general.Util"%>
<%@ page import="java.util.*"%>
<%@ page import="weaver.hrm.HrmUserVarify"%>
<%@ page import="weaver.hrm.User"%>
<%@ page import="weaver.conn.RecordSet"%>
<%@ page import="weaver.systeminfo.SystemEnv" %>
<%@ page import="weaver.login.LicenseCheckLogin" %>
<%@page import="weaver.hrm.settings.ChgPasswdReminder"%>
<%@page import="weaver.hrm.settings.RemindSettings"%>
<%@page import="weaver.file.Prop"%>
<%
String isTimeOutLogin = Prop.getPropValue("Others","isTimeOutLogin");
User user = HrmUserVarify.getUser (request , response) ;
String result = "[{\"name\":\"" + SystemEnv.getHtmlLabelName(22521, user.getLanguage()) + "\",\"key\":\"nodata\",\"isfirst\":\"1\"}]";
if("2".equals(isTimeOutLogin)){
	out.print(result);
	return;
}


String userOffline = Util.null2String((String)session.getAttribute("userOffline"));	
if(userOffline.equals("1")){
	//强制下线
	String loginfile = Util.getCookie(request , "loginfileweaver") ;
	Map userSessions = (Map) application.getAttribute("userSessions");
	if (userSessions != null) {
		Map logmessages = (Map) application.getAttribute("logmessages");
		if (logmessages != null)logmessages.remove("" + user.getUID());
		session.removeValue("moniter");
		session.removeValue("WeaverMailSet");
		userSessions.remove(user.getUID());
		session.invalidate();
	}%>
	<script language="javascript">
		window.top.Dialog.alert("<%=SystemEnv.getErrorMsgName(175,user.getLanguage())%>",function(){
			window.top.location="<%="/Refresh.jsp?loginfile="+loginfile+"&message=175"%>";
		});		
	</script>
	<%
  return;
}

//更新人员在线统计时间戳
LicenseCheckLogin onlineu = new LicenseCheckLogin();
onlineu.setOutLineDate(user.getUID());

result = getRemindMenu(user);
 
out.clearBuffer();
out.print(result);
%>
<%!private String getRemindMenu(User user) {
		if (user == null) {
			return null;
		}
		String s = "";

		int bgcnt = 4;
		int bgindex = 4;

		String[] sbgPostions = new String[] { "0 -28", "0 -84", "0 0", "0 -56" };

		RecordSet rs = new RecordSet();
	//	RequestUtil ru = new RequestUtil();
		String sql = "";
		int userid = user.getUID();
		int usertype = Util.getIntValue(user.getLogintype(), 1) - 1;
		String userID = String.valueOf(user.getUID());
		//int userid=user.getUID();
		String belongtoshow = "";
		rs.executeSql("select * from HrmUserSetting where resourceId = " + userID);
		if (rs.next()) {
			belongtoshow = rs.getString("belongtoshow");
		}
		String userIDAll = String.valueOf(user.getUID());
		String Belongtoids = user.getBelongtoids();
		int Belongtoid = 0;
		String[] arr2 = null;
		ArrayList<String> userlist = new ArrayList();
		userlist.add(userid + "");
		if (!"".equals(Belongtoids)) {
			userIDAll = userID + "," + Belongtoids;
			arr2 = Belongtoids.split(",");
			for (int i = 0; i < arr2.length; i++) {
				Belongtoid = Util.getIntValue(arr2[i]);
				userlist.add(Belongtoid + "");
			}
		}
		if ("1".equals(belongtoshow)) {
			if (rs.getDBType().equals("oracle")) {
				sql = "select a.type, sum(a.counts) as count, (select statistic from SysPoppupinfo where type=a.type) as statistic, (select typedescription from SysPoppupinfo where type=a.type) as typedescription, (select link from SysPoppupinfo where type=a.type) as link from SysPoppupRemindInfoNew a where  a.userid in ("
								+ userIDAll
								+ ") and a.usertype='"
								+ usertype
								+ "'  and ( (a.type=0 and a.requestid in (select requestid from workflow_currentoperator where userid in ("
								+ userIDAll
								+ ") and usertype='"
								+ usertype
								+ "' and islasttimes=1 and  isremark in ('0','1','8','9','7') ) )   or (a.type=1 and a.requestid in (select requestid from workflow_currentoperator where userid in ("
								+ userIDAll
								+ ") and usertype='"
								+ usertype
								+ "' and islasttimes=1 and  exists (select 1 from workflow_requestbase where workflow_requestbase.requestid=workflow_currentoperator.requestid and currentnodetype=3) ) ) or (a.type=14 and a.requestid in (select requestid from workflow_currentoperator where userid in ("
								+ userIDAll
								+ ") and usertype='"
								+ usertype
								+ "' and islasttimes=1 and  exists (select 1 from workflow_requestbase where workflow_requestbase.requestid=workflow_currentoperator.requestid) ) ) or (type=10 and requestid in (select requestid from workflow_currentoperator where ((isremark='0' and (isprocessed='2' or isprocessed='3' or isprocessed is null))  or isremark='5') and userid in ("
								+ userIDAll
								+ ") AND usertype='"
								+ usertype
								+ "' and islasttimes=1)) or (a.type=9 and a.requestid in (select id from cowork_items t1 where t1.status=1))or (a.type=15 and a.requestid in(select id from mailresource where folderid=0 and status='0' and canview=1 and resourceid in("
								+ userIDAll + ")))  or type in (2,3,4,6,7,8,11,12,13,21,25)) group by a.type";
			} else if(rs.getDBType().equals("mysql")){
				sql = "select a.type, sum(a.counts) as count, (select statistic from SysPoppupinfo where type=a.type) as statistic, (select typedescription from SysPoppupinfo where type=a.type) as typedescription, (select link from SysPoppupinfo where type=a.type) as link from SysPoppupRemindInfoNew a where  a.userid in ("
						+ userIDAll
						+ ") and a.usertype='"
						+ usertype
						+ "'  and ( (a.type=0 and a.requestid in (select requestid from workflow_currentoperator where userid in ("
						+ userIDAll
						+ ") and usertype='"
						+ usertype
						+ "' and islasttimes=1 and  isremark in ('0','1','8','9','7') ) )   or (a.type=1 and a.requestid in (select requestid from workflow_currentoperator where userid in ("
						+ userIDAll
						+ ") and usertype='"
						+ usertype
						+ "' and islasttimes=1 and  exists (select 1 from workflow_requestbase where workflow_requestbase.requestid=workflow_currentoperator.requestid and currentnodetype=3) ) ) or (a.type=14 and a.requestid in (select requestid from workflow_currentoperator where userid in ("
						+ userIDAll
						+ ") and usertype='"
						+ usertype
						+ "' and islasttimes=1 and  exists (select 1 from workflow_requestbase where workflow_requestbase.requestid=workflow_currentoperator.requestid) ) ) or (type=10 and requestid in (select requestid from workflow_currentoperator where ((isremark='0' and (isprocessed='2' or isprocessed='3' or isprocessed is null))  or isremark='5') and userid in ("
						+ userIDAll
						+ ") AND usertype='"
						+ usertype
						+ "' and islasttimes=1)) or (a.type=9 and a.requestid in (select id from cowork_items t1 where t1.status=1))or (a.type=15 and a.requestid in(select id from mailresource where folderid=0 and status='0' and canview=1 and resourceid in("
						+ userIDAll + ")))  or type in (2,3,4,6,7,8,11,12,13,21,25)) group by a.type";
			}else {
				sql = "select a.type, sum(a.counts) as count, (select statistic from SysPoppupinfo where type=a.type) as statistic, (select typedescription from SysPoppupinfo where type=a.type) as typedescription, (select link from SysPoppupinfo where type=a.type) as link from SysPoppupRemindInfoNew a where  a.userid in ("
								+ userIDAll
								+ ") and a.usertype='"
								+ usertype
								+ "'  and ( (a.type=0 and a.requestid in (select requestid from workflow_currentoperator where userid in ("
								+ userIDAll
								+ ") and usertype='"
								+ usertype
								+ "' and islasttimes=1 and  isremark in ('0','1','8','9','7') ) )   or (a.type=1 and a.requestid in (select requestid from workflow_currentoperator where userid in ("
								+ userIDAll
								+ ") and usertype='"
								+ usertype
								+ "' and islasttimes=1 and  exists (select 1 from workflow_requestbase where workflow_requestbase.requestid=workflow_currentoperator.requestid and currentnodetype=3) ) ) or (a.type=14 and a.requestid in (select requestid from workflow_currentoperator where userid in ("
								+ userIDAll
								+ ") and usertype='"
								+ usertype
								+ "' and islasttimes=1 and  exists (select 1 from workflow_requestbase where workflow_requestbase.requestid=workflow_currentoperator.requestid) ) ) or (type=10 and requestid in (select requestid from workflow_currentoperator where ((isremark='0' and (isprocessed='2' or isprocessed='3' or isprocessed is null))  or isremark='5') and userid in ("
								+ userIDAll
								+ ") AND usertype='"
								+ usertype
								+ "' and islasttimes=1)) or (a.type=9 and a.requestid in (select id from cowork_items t1 where  t1.status=1)) or (a.type=15 and a.requestid in(select id from mailresource where folderid=0 and status='0' and canview=1 and resourceid in("
								+ userIDAll + "))) or type in (2,3,4,6,7,8,11,12,13,21,25)) group by a.type";
			}
		} else {
			if (rs.getDBType().equals("oracle")) {
				sql = "select a.type, sum(a.counts) as count, (select statistic from SysPoppupinfo where type=a.type) as statistic, (select typedescription from SysPoppupinfo where type=a.type) as typedescription, (select link from SysPoppupinfo where type=a.type) as link from SysPoppupRemindInfoNew a where  a.userid="
								+ userid
								+ " and a.usertype='"
								+ usertype
								+ "'  and ( (a.type=0 and a.requestid in (select requestid from workflow_currentoperator where userid="
								+ userid
								+ " and usertype='"
								+ usertype
								+ "' and islasttimes=1 and  isremark in ('0','1','8','9','7') ) )   or (a.type=1 and a.requestid in (select requestid from workflow_currentoperator where userid="
								+ userid
								+ " and usertype='"
								+ usertype
								+ "' and islasttimes=1 and  exists (select 1 from workflow_requestbase where workflow_requestbase.requestid=workflow_currentoperator.requestid and currentnodetype=3) ) ) or (a.type=14 and a.requestid in (select requestid from workflow_currentoperator where userid="
								+ userid
								+ " and usertype='"
								+ usertype
								+ "' and islasttimes=1 and  exists (select 1 from workflow_requestbase where workflow_requestbase.requestid=workflow_currentoperator.requestid) ) ) or (type=10 and requestid in (select requestid from workflow_currentoperator where ((isremark='0' and (isprocessed='2' or isprocessed='3' or isprocessed is null))  or isremark='5') and userid="
								+ userid
								+ " AND usertype='"
								+ usertype
								+ "' and islasttimes=1)) or (a.type=9 and a.requestid in (select id from cowork_items t1 where t1.status=1)) or (a.type=15 and a.requestid in(select id from mailresource where folderid=0 and status='0' and canview=1 and resourceid ="
								+ userid + ")) or type in (2,3,4,6,7,8,11,12,13,21,25)) group by a.type";
			}else if(rs.getDBType().equals("mysql")){
				sql = "select a.type, sum(a.counts) as count, (select statistic from SysPoppupinfo where type=a.type) as statistic, (select typedescription from SysPoppupinfo where type=a.type) as typedescription, (select link from SysPoppupinfo where type=a.type) as link from SysPoppupRemindInfoNew a where  a.userid="
						+ userid
						+ " and a.usertype='"
						+ usertype
						+ "'  and ( (a.type=0 and a.requestid in (select requestid from workflow_currentoperator where userid="
						+ userid
						+ " and usertype='"
						+ usertype
						+ "' and islasttimes=1 and  isremark in ('0','1','8','9','7') ) )   or (a.type=1 and a.requestid in (select requestid from workflow_currentoperator where userid="
						+ userid
						+ " and usertype='"
						+ usertype
						+ "' and islasttimes=1 and  exists (select 1 from workflow_requestbase where workflow_requestbase.requestid=workflow_currentoperator.requestid and currentnodetype=3) ) ) or (a.type=14 and a.requestid in (select requestid from workflow_currentoperator where userid="
						+ userid
						+ " and usertype='"
						+ usertype
						+ "' and islasttimes=1 and  exists (select 1 from workflow_requestbase where workflow_requestbase.requestid=workflow_currentoperator.requestid) ) ) or (type=10 and requestid in (select requestid from workflow_currentoperator where ((isremark='0' and (isprocessed='2' or isprocessed='3' or isprocessed is null))  or isremark='5') and userid="
						+ userid
						+ " AND usertype='"
						+ usertype
						+ "' and islasttimes=1)) or (a.type=9 and a.requestid in (select id from cowork_items t1 where t1.status=1)) or (a.type=15 and a.requestid in(select id from mailresource where folderid=0 and status='0' and canview=1 and resourceid ="
						+ userid + ")) or type in (2,3,4,6,7,8,11,12,13,21,25)) group by a.type";
			}
			else {
				sql = "select a.type, sum(a.counts) as count, (select statistic from SysPoppupinfo where type=a.type) as statistic, (select typedescription from SysPoppupinfo where type=a.type) as typedescription, (select link from SysPoppupinfo where type=a.type) as link from SysPoppupRemindInfoNew a where  a.userid="
								+ userid
								+ " and a.usertype='"
								+ usertype
								+ "'  and ( (a.type=0 and a.requestid in (select requestid from workflow_currentoperator where userid="
								+ userid
								+ " and usertype='"
								+ usertype
								+ "' and islasttimes=1 and  isremark in ('0','1','8','9','7') ) )   or (a.type=1 and a.requestid in (select requestid from workflow_currentoperator where userid="
								+ userid
								+ " and usertype='"
								+ usertype
								+ "' and islasttimes=1 and  exists (select 1 from workflow_requestbase where workflow_requestbase.requestid=workflow_currentoperator.requestid and currentnodetype=3) ) ) or (a.type=14 and a.requestid in (select requestid from workflow_currentoperator where userid="
								+ userid
								+ " and usertype='"
								+ usertype
								+ "' and islasttimes=1 and  exists (select 1 from workflow_requestbase where workflow_requestbase.requestid=workflow_currentoperator.requestid) ) ) or (type=10 and requestid in (select requestid from workflow_currentoperator where ((isremark='0' and (isprocessed='2' or isprocessed='3' or isprocessed is null))  or isremark='5') and userid="
								+ userid
								+ " AND usertype='"
								+ usertype
								+ "' and islasttimes=1)) or (a.type=9 and a.requestid in (select id from cowork_items t1 where t1.status=1)) or (a.type=15 and a.requestid in(select id from mailresource where folderid=0 and status='0' and canview=1 and resourceid ="
								+ userid + ")) or type in (2,3,4,6,7,8,11,12,13,21,25)) group by a.type";
			}
		}
		/* if (ru.getOfsSetting().getIsuse() == 1) {
			if ("1".equals(belongtoshow)) {
				sql = "select a.type, sum(a.counts) as count, (select statistic from SysPoppupinfo where type=a.type) as statistic, (select typedescription from SysPoppupinfo where type=a.type) as typedescription, (select link from SysPoppupinfo where type=a.type) as link from SysPoppupRemindInfoNew a where  a.userid in ("
								+ userIDAll
								+ ") and a.usertype='"
								+ usertype
								+ "'  and ( (a.type=0 and (a.requestid in (select requestid from workflow_currentoperator where userid in ("
								+ userIDAll
								+ ") and usertype='"
								+ usertype
								+ "' and islasttimes=1 and  isremark in ('0','1','8','9','7') ) or a.requestid in (select requestid from ofs_todo_data where userid in ("
								+ userIDAll
								+ ") and viewtype='0' and islasttimes=1 ) ) )   or (a.type=1 and a.requestid in (select requestid from workflow_currentoperator where userid in ("
								+ userIDAll
								+ ") and usertype='"
								+ usertype
								+ "' and islasttimes=1 and  exists (select 1 from workflow_requestbase where workflow_requestbase.requestid=workflow_currentoperator.requestid and currentnodetype=3) ) ) or (a.type=14 and a.requestid in (select requestid from workflow_currentoperator where userid in ("
								+ userIDAll
								+ ") and usertype='"
								+ usertype
								+ "' and islasttimes=1 and  exists (select 1 from workflow_requestbase where workflow_requestbase.requestid=workflow_currentoperator.requestid) ) ) or (type=10 and requestid in (select requestid from workflow_currentoperator where ((isremark='0' and (isprocessed='2' or isprocessed='3' or isprocessed is null))  or isremark='5') and userid in ("
								+ userIDAll
								+ ") AND usertype='"
								+ usertype
								+ "' and islasttimes=1)) or (a.type=9 and a.requestid in (select id from cowork_items t1 where  t1.status=1)) or (a.type=15 and a.requestid in(select id from mailresource where folderid=0 and status='0' and canview=1 and resourceid in("
								+ userIDAll + "))) or type in (2,3,4,6,7,8,11,12,13,21,25)) group by a.type";

			} else {
				sql = "select a.type, sum(a.counts) as count, (select statistic from SysPoppupinfo where type=a.type) as statistic, (select typedescription from SysPoppupinfo where type=a.type) as typedescription, (select link from SysPoppupinfo where type=a.type) as link from SysPoppupRemindInfoNew a where  a.userid="
								+ userid
								+ " and a.usertype='"
								+ usertype
								+ "'  and ( (a.type=0 and (a.requestid in (select requestid from workflow_currentoperator where userid="
								+ userid
								+ " and usertype='"
								+ usertype
								+ "' and islasttimes=1 and  isremark in ('0','1','8','9','7') ) or a.requestid in (select requestid from ofs_todo_data where userid in ("
								+ userIDAll
								+ ") and viewtype='0' and islasttimes=1) ) )   or (a.type=1 and a.requestid in (select requestid from workflow_currentoperator where userid="
								+ userid
								+ " and usertype='"
								+ usertype
								+ "' and islasttimes=1 and  exists (select 1 from workflow_requestbase where workflow_requestbase.requestid=workflow_currentoperator.requestid and currentnodetype=3) ) ) or (a.type=14 and a.requestid in (select requestid from workflow_currentoperator where userid="
								+ userid
								+ " and usertype='"
								+ usertype
								+ "' and islasttimes=1 and  exists (select 1 from workflow_requestbase where workflow_requestbase.requestid=workflow_currentoperator.requestid) ) ) or (type=10 and requestid in (select requestid from workflow_currentoperator where ((isremark='0' and (isprocessed='2' or isprocessed='3' or isprocessed is null))  or isremark='5') and userid="
								+ userid
								+ " AND usertype='"
								+ usertype
								+ "' and islasttimes=1)) or (a.type=9 and a.requestid in (select id from cowork_items t1 where t1.status=1)) or (a.type=15 and a.requestid in(select id from mailresource where folderid=0 and status='0' and canview=1 and resourceid ="
								+ userid + ")) or type in (2,3,4,6,7,8,11,12,13,21,25)) group by a.type";

			}
		} */
		rs.executeSql(sql);

		ChgPasswdReminder reminder = new ChgPasswdReminder();
		RemindSettings settings = reminder.getRemindSettings();
		while (rs.next()) {
			if ("2".equals(rs.getString("type"))) {//生日

				String birth_valid = settings.getBirthvalid();
				String birth_remindmode = settings.getBirthremindmode();

				if (birth_valid != null && birth_valid.equals("1")) {
					if (birth_remindmode != null && birth_remindmode.equals("1")) {
					} else {
						continue;
					}
				} else {
					continue;
				}
			}
			bgindex++;
			int count = 0;
			String itemName = SystemEnv.getHtmlLabelName(rs.getInt("typedescription"), user.getLanguage());
			if (rs.getString("statistic").equals("y")) {
				count = rs.getInt("count");
			}
			s +=  ",{\"name\":\"" +itemName+ "\",\"url\":\""+rs.getString("link") + "\",\"count\":\""+count + "\",\"key\":\""+rs.getString("type") +"\"}";
		}
		if (s.equals("")) {
			s = "{\"name\":\"" + SystemEnv.getHtmlLabelName(22521, user.getLanguage()) + "\",\"key\":\"nodata\"}";
		}else{
			s= s.substring(1);
		}
 		/* s =  "{\"name\":\"新到达流程\",\"url\":\"/system/sysRemindWfLink.jsp?flag=newWf\",\"count\":\"10\",\"key\":\"0\"}";
		s +=  ",{\"name\":\"工作流完成\",\"url\":\"/system/sysRemindWfLink.jsp?flag=endWf\",\"count\":\"9\",\"key\":\"1\"}";
		s +=  ",{\"name\":\"新到达邮件\",\"url\":\"/system/sysRemindWfLink.jsp?flag=newEmail\",\"count\":\"8\",\"key\":\"15\"}";
			 */	   
		return  "["+s+"]";
	}%>