📄 sumqxxsaction.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.oa;
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.JYQK;
import org.ug.sztz.domain.oa.StudentBaseInfo;
import org.ug.sztz.domain.oa.StudentJYInfo;
import org.ug.sztz.domain.oa.TongJi_JiuYe;
/**
* @author Skywalker
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class SumQxxsAction extends BaseAction {
// TODO Auto-generated method stub
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
List datalist=null;
String worktype=request.getParameter("worktype");
if(worktype==null){
datalist=this.tjjyDao.getTJJYListByType("3");//如果从数据库中取得的数据不为空的话,从库中取得数据
if(datalist!=null&&datalist.size()!=0){
request.setAttribute("jyqk",datalist);
request.setAttribute("time",((TongJi_JiuYe)datalist.get(0)).getDatetime());
return mapping.findForward("success");
}
}
HashMap map = new HashMap();//如果从数据库中取得的数据为空的话,进行统计,并存入库中供使用
map.put("jlstatus", new Integer(1));
List jyList = this.stuJYDao.getStudentJYInfoList(map);
Vector all = new Vector();
JYQK main = new JYQK();
for (int i = 0; i < jyList.size(); i++) {
sum(((StudentJYInfo) jyList.get(i)).getJyxs(), main);
}
main.setKyl(0);
main.setQyl(0);
main.setJyl(0);
main.setZy("总计");
main.setSum(jyList.size());
all.add(main);
String allsql = "select bysbase.* from bysbase,bysjy where bysbase.xh=bysjy.xh and bysbase.xsstatus='1' order by bysjy.byqx";
map = new HashMap();
map.put("sql", allsql);
List allList = this.stuBaseDao.getSQLBaseInfoList(map);
Vector byqxList = new Vector();
String temp = "";
for (int i = 0; i < allList.size(); i++) {//
StudentJYInfo jyinfo=this.stuJYDao.getStudentJYInfoByXh(((StudentBaseInfo) allList.get(i)).getXh());
String byqx = jyinfo.getByqx().trim();
if (!byqx.equals(temp)) {
temp = byqx;
byqxList.add(byqx);
}
}
System.out.println(byqxList.size());
for (int i = 0; i < byqxList.size(); i++) {
String sql = "select bysbase.* from bysbase,bysjy where bysbase.xh=bysjy.xh and bysbase.xsstatus='1' and bysjy.byqx='" + byqxList.get(i) + "'";
map.put("sql", sql);
List sList = this.stuBaseDao.getSQLBaseInfoList(map);
Vector byqxjyList = new Vector();//某学院学生就业信息列表
for(int j=0;j<sList.size();j++)
{
StudentJYInfo info = this.stuJYDao.getStudentJYInfoByXh(((StudentBaseInfo)sList.get(j)).getXh());
byqxjyList.add(info);
}
JYQK qk = new JYQK();
for (int j = 0; j < byqxjyList.size(); j++) {
sum(((StudentJYInfo) byqxjyList.get(j)).getJyxs(),qk);
}
qk.setKyl(0);
qk.setQyl(0);
qk.setJyl(0);
qk.setZy((String)byqxList.get(i));
qk.setSum(byqxjyList.size());
all.add(qk);
}
datalist=this.tjjyDao.getTJJYListByType("3");//读出记录
if(datalist==null||datalist.size()==0){
this.savedate(all,3);//存入数据库
}else{
System.out.println("数据更新");
this.updatedate(all,3);//更新数据库
}
datalist=this.tjjyDao.getTJJYListByType("3");//读出记录
request.setAttribute("time",((TongJi_JiuYe)datalist.get(0)).getDatetime());
request.setAttribute("jyqk",datalist);
return mapping.findForward("success");
}
private void sum(String jyxs, JYQK qk) {
jyxs = jyxs.trim();
if (jyxs.equals("签就业协议")) {
qk.pq++;
} else if (jyxs.equals("已上博士后") || jyxs.equals("已上博")
|| jyxs.equals("已上硕") || jyxs.equals("以上二学位")) {
qk.ky++;
} else if (jyxs.equals("已出国")) {
qk.cg++;
} else if (jyxs.equals("服务北京基层")) {
qk.fwjc++;
} else if (jyxs.equals("志愿服务西部")) {
qk.fwxb++;
} else if (jyxs.equals("签劳动合同") || jyxs.equals("灵活就业")
|| jyxs.equals("单位用人证明") || jyxs.equals("自由职业")
|| jyxs.equals("自主创业")) {
qk.yx++;
} else if (jyxs.equals("回省待就业")) {
qk.ef++;
} else if (jyxs.equals("在京待就业")) {
qk.df++;
}
}
private void savedate(List list,int type){
for(int i=0;i<list.size();i++){
JYQK basedate=(JYQK)list.get(i);
TongJi_JiuYe tjjy=new TongJi_JiuYe();
tjjy.setSum(basedate.getSum());
tjjy.setPaiqian(basedate.getPq());
tjjy.setKaoyan(basedate.getKy());
tjjy.setChuguo(basedate.getCg());
tjjy.setFuwujiceng(basedate.getFwjc());
tjjy.setFuwuxibu(basedate.getFwxb());
tjjy.setErfeng(basedate.getEf());
tjjy.setYingxing(basedate.getYx());
tjjy.setDaifeng(basedate.getDf());
tjjy.setKaoyanlu(basedate.getKyl());
tjjy.setQianyuelu(basedate.getQyl());
tjjy.setJiuyelu(basedate.getJyl());
tjjy.setDatetime(org.ug.sztz.domain.assistant.DateProcessor.getStringDate());
tjjy.setType(3);//设置类型,表示为学院统计
tjjy.setZy("");
tjjy.setXy("");
tjjy.setByqx(basedate.getZy());//设置毕业去向
this.tjjyDao.insertTJJY(tjjy);//将记录存入到数据库中
}
}
private void updatedate(List list,int type){
for(int i=0;i<list.size();i++){
JYQK basedate=(JYQK)list.get(i);
TongJi_JiuYe tjjy=new TongJi_JiuYe();
tjjy.setSum(basedate.getSum());
tjjy.setPaiqian(basedate.getPq());
tjjy.setKaoyan(basedate.getKy());
tjjy.setChuguo(basedate.getCg());
tjjy.setFuwujiceng(basedate.getFwjc());
tjjy.setFuwuxibu(basedate.getFwxb());
tjjy.setErfeng(basedate.getEf());
tjjy.setYingxing(basedate.getYx());
tjjy.setDaifeng(basedate.getDf());
tjjy.setKaoyanlu(basedate.getKyl());
tjjy.setQianyuelu(basedate.getQyl());
tjjy.setJiuyelu(basedate.getJyl());
tjjy.setDatetime(org.ug.sztz.domain.assistant.DateProcessor.getStringDate());
tjjy.setType(3);//设置类型,表示为专业统计
tjjy.setZy("");
tjjy.setXy("");
tjjy.setByqx(basedate.getZy());
HashMap map=new HashMap();
map.put("type",String.valueOf(type));
map.put("byqx",basedate.getZy());
if(this.tjjyDao.getTJJYByMap(map)==null)
this.tjjyDao.insertTJJY(tjjy);
else
this.tjjyDao.updateTJJY_BYQX(tjjy);//更新数据
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -