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

📄 indexaction.java

📁 一个oa系统
💻 JAVA
字号:
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package com.oa.personaloffice.action;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.oa.companyculture.db.InfoDao;
import com.oa.db.AcceptmailDAO;
import com.oa.db.ActiveDAO;
import com.oa.db.Affiche;
import com.oa.db.AfficheDAOImpl;
import com.oa.db.Resource;
import com.oa.db.ResourceDAO;
import com.oa.db.StaffbasicinfoDAO;
import com.oa.db.User;
import com.oa.db.UserDAO;
import com.oa.db.Weeklycircle;
import com.oa.db.WeeklycircleDAO;
import com.oa.db.Weeklyinput;
import com.oa.db.WeeklyinputDAO;

/**
 * MyEclipse Struts Creation date: 09-14-2007
 * 
 * XDoclet definition:
 * 
 * @struts.action validate="true"
 * @struts.action-forward name="success" path="/index.jsp"
 * 
 * 作者:李海红 
 * 
 * 最后修改时间:2007年10月24
 */
public class IndexAction extends Action {
	/*
	 * Generated Methods
	 */
	private UserDAO dao;

	private AcceptmailDAO adao;

	private WeeklyinputDAO wdao;

	private WeeklycircleDAO cdao;

	private ResourceDAO rdao;

	private ActiveDAO ndao;

	private InfoDao infoDao;

	/**
	 * Method execute
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 */
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		// TODO Auto-generated method stub
		response.setCharacterEncoding("gbk");
		HttpSession session = request.getSession();
		String username = (String) session.getAttribute("username");
		String realname = (String) session.getAttribute("realname");
		request.setAttribute("realname", realname);
		String accepterid = dao.ByUsernameQueryId(username) + "";// 接收者用户id

		List list3 = (List) adao.Whetherreadtotal(accepterid);
		request.setAttribute("totalresult", list3.size());//统计未读邮件

		List clist = cdao.QueryPeriod();
		int period = 0;
		if (clist != null && clist.size() != 0) {
			Weeklycircle wo = (Weeklycircle) clist.get(0);
			period = wo.getPeriod();
		}
		List wlist = wdao.ByPeriodAndUsernameQuery((period-1), Integer.parseInt(accepterid));
		String whethercheck = "";
		if (wlist != null && wlist.size() != 0) {
			Weeklyinput wo = (Weeklyinput) wlist.get(0);
			whethercheck = wo.getWhethercheck();//System.out.println(whethercheck);
			request.setAttribute("whethercheck", whethercheck);//上期周报状态
		}
		
		List rlist = rdao.Querybytype("0");// 共享资源
		ArrayList<String[]> slist = new ArrayList<String[]>();
		if (rlist != null && rlist.size()!=0) {
			for (int r = 0; r < rlist.size(); r++) {
			   Resource ro = (Resource) rlist.get(r);
			   if (ro.getRealfilename() != null&& !ro.getRealfilename().equals("null")&& !ro.getRealfilename().equals("")&& ro.getRealfilename() != null&& !ro.getRealfilename().equals("null")&& !ro.getRealfilename().equals("")) {
					String[] realaddr = ro.getRealfilename().replaceAll("///", ",").split("\\,");
					String[] addr = ro.getFilename().replaceAll("///", ",").split("\\,");
					for (int k = 0; k < addr.length; k++) {
						String[] strrow = new String[2];
						strrow[0] = addr[k];
						strrow[1] = realaddr[k];
						slist.add(strrow);
					}
				}			
			}
		}
		if (slist != null && slist.size() >= 4) {
			request.setAttribute("slist", slist.subList(0, 4));
		} else {
			request.setAttribute("slist", slist);
		}

		List nlist = ndao.Query(); //公司活动
		if (nlist != null && nlist.size() >=4) {
			request.setAttribute("nlist", nlist.subList(0, 4));
		} else {
			request.setAttribute("nlist", nlist);
		}

		/* 最新帖子列表的获得 */
		List newinfolist = (List) infoDao.findTopSix();
		if (newinfolist != null && newinfolist.size() >= 4) {
			request.setAttribute("newinfo", newinfolist.subList(0, 4));
		} else if (newinfolist != null && newinfolist.size() < 4) {
			request.setAttribute("newinfo", newinfolist);
		}

		ArrayList<Affiche> afficheList3 = new ArrayList<Affiche>();
		ArrayList<Affiche> afficheList4 = new ArrayList<Affiche>();
		List list = staffbassicInfoDao.QueryStaffbasicinfo(username);
		User staffbasicInfo = new User();
		if (list != null && list.size() != 0) {
			staffbasicInfo = (User) list.get(0);
		}
		int deptId = staffbasicInfo.getDepartmentid();
		afficheList3 = afficheDao.showNewMenberAfficheByDeptId(deptId);
		afficheList4 = afficheDao.showNewMenberAfficheByDeptId(99);
		session.setAttribute("afficheList3", afficheList3);
		session.setAttribute("afficheList4", afficheList4);
		return mapping.findForward("success");
	}

	public InfoDao getInfoDao() {
		return infoDao;
	}

	public void setInfoDao(InfoDao infoDao) {
		this.infoDao = infoDao;
	}

	public ResourceDAO getRdao() {
		return rdao;
	}

	public void setRdao(ResourceDAO rdao) {
		this.rdao = rdao;
	}

	private Affiche affice;

	private AfficheDAOImpl afficheDao;

	public void setAfficheDao(AfficheDAOImpl afficheDao) {
		this.afficheDao = afficheDao;
	}

	public void setAffice(Affiche affice) {
		this.affice = affice;
	}

	private StaffbasicinfoDAO staffbassicInfoDao;

	public void setStaffbassicInfoDao(StaffbasicinfoDAO staffbassicInfoDao) {
		this.staffbassicInfoDao = staffbassicInfoDao;
	}

	public AcceptmailDAO getAdao() {
		return adao;
	}

	public void setAdao(AcceptmailDAO adao) {
		this.adao = adao;
	}

	public WeeklycircleDAO getCdao() {
		return cdao;
	}

	public void setCdao(WeeklycircleDAO cdao) {
		this.cdao = cdao;
	}

	public UserDAO getDao() {
		return dao;
	}

	public void setDao(UserDAO dao) {
		this.dao = dao;
	}

	public WeeklyinputDAO getWdao() {
		return wdao;
	}

	public void setWdao(WeeklyinputDAO wdao) {
		this.wdao = wdao;
	}

	public Affiche getAffice() {
		return affice;
	}

	public AfficheDAOImpl getAfficheDao() {
		return afficheDao;
	}

	public StaffbasicinfoDAO getStaffbassicInfoDao() {
		return staffbassicInfoDao;
	}

	public ActiveDAO getNdao() {
		return ndao;
	}

	public void setNdao(ActiveDAO ndao) {
		this.ndao = ndao;
	}
}

⌨️ 快捷键说明

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