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

📄 sumjlaction.java

📁 基于JAVA的学生就业信息网 实现对信息浏览 检索 审核 修改和删除
💻 JAVA
字号:
/*
 * Created on 2006-7-31
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package org.ug.sztz.webview.structs.actions.college;

import java.util.HashMap;
import java.util.List;
import java.util.Vector;

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

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.ug.sztz.domain.oa.FuDaoYuan;
import org.ug.sztz.domain.oa.JLTJ;
import org.ug.sztz.domain.oa.JianLi;
import org.ug.sztz.domain.oa.StudentBaseInfo;

/**
 * @author Skywalker
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class SumJlAction extends BaseAction {

	/* (non-Javadoc)
	 * @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
	 */
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) throws Exception {
		// TODO Auto-generated method stub
		FuDaoYuan fdy = (FuDaoYuan) request.getSession().getAttribute("fdy");
		String allsql = "select * from bysbase where fdyxm='"+fdy.getName()+"' order by zy";
		HashMap map = new HashMap();
		map.put("sql",allsql);
		try {
			List allList = this.stuBaseDao.getSQLBaseInfoList(map);
			Vector zySum = new Vector();
			Vector zyList = new Vector();
			Vector jlSum = new Vector();
			int sum = 0;
			String temp="";
			for(int i=0;i<allList.size();i++){
				String zy = ((StudentBaseInfo)allList.get(i)).getZy();
				if(!zy.equals(temp)){
					temp = zy;
					zyList.add(zy);
					if(i!=0)
						zySum.add(new Integer(sum));
					sum=0;
				}
				sum++;
			}
			zySum.add(new Integer(sum));
			
			for(int i=0;i<zyList.size();i++){
				sum=0;
				String sql = "select * from bysbase where fdyxm='"+fdy.getName()+"' and zy='"+zyList.get(i)+"'";
				map.put("sql",sql);
				List sList = this.stuBaseDao.getSQLBaseInfoList(map);
				
				for(int j=0;j<sList.size();j++){
				     String xh  = ((StudentBaseInfo)sList.get(j)).getXh();
				     JianLi jl = this.stuJianLiDao.getStudentJianLiByXh(xh);
				     if(jl!=null)
				     	sum++;
				}
				jlSum.add(new Integer(sum));
			}
			
			for(int i=0;i<zyList.size();i++){
				String zy=(String) zyList.get(i);
				int allnumber=((Integer)zySum.get(i)).intValue();
				int jlnumber=((Integer)jlSum.get(i)).intValue();
				JLTJ jltj=new JLTJ();
				jltj.setZy(zy);
				jltj.setAllnumber(allnumber);
				jltj.setJlnumber(jlnumber);
				jltj.setBfb(jlnumber/allnumber*100);
				
				zyList.set(i,jltj);
			}
			request.setAttribute("zylist",zyList);
			return mapping.findForward("success");
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			request.setAttribute("reason","数据库操作失败!");
			return mapping.findForward("failure");
		}
	} 
}

⌨️ 快捷键说明

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