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

📄 getdwxxaction.java

📁 基于JAVA的学生就业信息网 实现对信息浏览 检索 审核 修改和删除
💻 JAVA
字号:
/*
 * Created on 2005-7-2
 *
 * 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;

import java.text.SimpleDateFormat;
import java.util.Date;
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.assistant.DateProcessor;
import org.ug.sztz.domain.assistant.ProvinceListFactory;
import org.ug.sztz.domain.assistant.SchoolFactory;
import org.ug.sztz.domain.oa.DanWeiInfo;
import org.ug.sztz.domain.oa.NewsEntity;
import org.ug.sztz.domain.oa.SC;
import org.ug.sztz.domain.oa.Sort;
import org.ug.sztz.domain.oa.StudentBaseInfo;
import org.ug.sztz.domain.oa.XQInfo;
import org.ug.sztz.domain.oa.ZPHInfo;

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

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		List sortlist = sortDao.getSortList();//栏目列表
		int jysortid = 0;
		for (int i = 0; i < sortlist.size(); i++) {
			Sort sort = (Sort) sortlist.get(i);
			if ((sort.getSortname()).trim().equals("就业新闻")) {
				jysortid = sort.getId();
				break;
			}
		}

		HashMap map = new HashMap();
		map.put("sort", String.valueOf(jysortid));
		map.put("newsstatus", "1");
		map.put("newsdate", "newsdate");
		List jynewslist = this.newsDao.getNewsListByFatherSort(map, 0, 4);//取得新业新闻列表
		for (int i = 0; i < jynewslist.size(); i++) {
			NewsEntity news = (NewsEntity) jynewslist.get(i);
			news.setNewsdate(news.getNewsdate().substring(0, 10));
		}
		map.put("type", "8");
		List gglist = this.newsDao.getNewsListByType(map, 0, 4);//取得公告列表

		map.put("dwstatus", "1");
		List dwlist = this.dwxxDao.getDanWeiInfoList(map, 0, 4);
		for (int i = 0; i < dwlist.size(); i++) {
			DanWeiInfo dw = (DanWeiInfo) dwlist.get(i);
			dw.setDwdate(dw.getDwdate().substring(0, 10));
		}
		map.put("zphstatus", "1");
		List zphlist = this.zphxxDao.getZPHInfoList(map, 0, 4);
		for (int i = 0; i < zphlist.size(); i++) {
			ZPHInfo zph = (ZPHInfo) zphlist.get(i);
			Date nowdate = new Date();
			SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd");
			dateformat.setLenient(false);
			String sdate = zph.getZphdate();
			Date zphdate = dateformat.parse(sdate);
			if (nowdate.after(zphdate)) {//如果招聘会已过
				zph.setZphbz("@");//用单位名称作标记表示招聘会时间已过
			}
			zph.setZphfbdate(zph.getZphfbdate().substring(0, 10));

		}

		request.setAttribute("sortlist", sortlist);
		request.setAttribute("jynewslist", jynewslist);
		request.setAttribute("gglist", gglist);
		request.setAttribute("dwlist", dwlist);
		request.setAttribute("zphlist", zphlist);

		//以下是取得单位信息部分action
		String id = request.getParameter("id");
		this.dwxxDao.updateDanWeiDJ(id);
		DanWeiInfo dwinfo = this.dwxxDao.getDanWeiInfoById(id);
		
		if (request.getSession().getAttribute("fdy") == null
				&& request.getSession().getAttribute("dwinfo") == null
				&& request.getSession().getAttribute("user") == null
				&& request.getSession().getAttribute("baseinfo") == null 
				&& dwinfo.getDwfl()==0) {
				request.setAttribute("reason","您没有权限查看该条信息,请先登陆!");
				return mapping.findForward("login");
		}
		map.put("dwzh", dwinfo.getDwzh());
		map.put("fb", "1");
		List xqlist = this.xqxxDao.getXQInfoListByMap(map);
		for (int i = 0; i < xqlist.size(); i++) {
			String newzyyq = "";
			XQInfo xq = (XQInfo) xqlist.get(i);
			String zyyq = xq.getXqzyyq().trim();
			String[] detail = zyyq.split(";");//用“;”拆分字符串,结果为一个字符数组,每一元素为一条具体需求信息
			for (int k = 0; k < detail.length; k++) {
				String[] item = detail[k].split("-");//用“-”拆分字符串,结果为一个字符数组,第一项为学生类型,第二项为需求专业,第三项为需求数,第四项为相关要求
				newzyyq = newzyyq.concat("学历:".concat(item[0]).concat(",专业:")
						.concat(item[1]).concat(",人数:").concat(item[2]).concat(
								"人,其它要求:").concat(item[3]).concat("<br></br>"));
			}
			xq.setXqzyyq(newzyyq);
			xqlist.set(i, xq);
		}
		request.setAttribute("dwinfo", dwinfo);
		request.setAttribute("xqlist", xqlist);
		ProvinceListFactory factory = new ProvinceListFactory(this.getServlet()
				.getServletConfig());
		List province = factory.getProvinceList();
		request.setAttribute("provincelist", province);

		StudentBaseInfo stu = (StudentBaseInfo) request.getSession()
				.getAttribute("baseinfo");
		if (stu != null) {
			String xh = stu.getXh();
			map.put("xh", xh);
			SC sc = this.scDao.getSCByZhAndDwzh(map);
			request.setAttribute("sc", sc);
		}

		return mapping.findForward("success");

	}
}

⌨️ 快捷键说明

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