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

📄 c71action.java

📁 使用spring ,hibernate 框架的稽查管理系统
💻 JAVA
字号:

package com.je.ims.controller.c71;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Properties;

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

import org.springframework.web.bind.RequestUtils;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import com.chttl.im.organization.Person;
import com.je.ims.controller.login.RoleDetails;
import com.je.ims.dao.C71DAO;
import com.je.ims.hibernate.Docflow;
import com.je.ims.hibernate.Role;
import com.je.ims.hibernate.RoleId;
import com.je.ims.util.FlowUtils;
import com.je.ims.util.MenuUtils;
import com.je.ims.util.Page;

public class C71Action implements Controller {

    private C71DAO dao;
    private Person person;
    HttpSession session=null;
    public void setDao(C71DAO dao)
    {
    	this.dao=dao;
    }

    public ModelAndView handleRequest(HttpServletRequest arg0,
			HttpServletResponse arg1) throws Exception {
		// TODO Auto-generated method stub
		ModelAndView model=null;
		String actionType=null;
	    HttpSession session=arg0.getSession();
		person=(Person)session.getAttribute("person");
		if(person==null)
			{
			session.invalidate();
			arg1.sendRedirect("./login.jsp");
			}
		try
		{
			actionType=new String(RequestUtils.getRequiredStringParameter(arg0, "actionType").getBytes("ISO-8859-1"),"MS950");
		}
		catch(Exception e)
		{
			model=handleUnSetted(arg0,arg1);
			return model;
		}
		if(actionType.equals("showhistory"))
			model=showHistory(arg0,arg1);
		if(actionType.equals("showchecked"))
			model=showChecked(arg0,arg1);
		if(actionType.equals("savetemp"))
			model=saveTemp(arg0,arg1);
		if(actionType.equals("checkok"))
			model=checkOk(arg0,arg1);
		if(actionType.equals("receive"))
			model=receive(arg0,arg1);
		return model;
	}
	public ModelAndView handleUnSetted(HttpServletRequest arg0,
			HttpServletResponse arg1) throws Exception{
		ModelAndView model=null;
		Page p=new Page();
		int pageSize=p.getPageSize(); 
		int count=p.getCount(); 
        session=arg0.getSession();
		LinkedList list=(LinkedList)session.getAttribute("menu");
		List roleList=MenuUtils.getRole(list,"c71.do");
		List current=new LinkedList();
		List list1=new LinkedList();
		String pageNo=arg0.getParameter("pageNo");
//		try{
			for(int i=0;i<roleList.size();i++)
			{
				RoleId id=(RoleId)roleList.get(i);
			list1=dao.getUnHandledEvent(id);
			if(list1!=null&&list1.size()>0)
			current.addAll(list1);
		    }
//		}
//		catch(Exception e)
//		{
//			String errormessage="read database error";
//			String location="c6.do";
//			Map map=new HashMap();
//			map.put("errormessage",errormessage);
//			map.put("link",location);
//			return new ModelAndView("error.jsp");
//		}
		for(int i=0;i<current.size();i++)
		{
			Docflow temp=(Docflow)current.get(i);
			if(temp.getAction()!=null)
			{
				current.remove(i);
				i--;
				continue;
			}
			if(temp.getEditState()!=null){
			if(temp.getEditState().longValue()==0)
			{
				current.remove(i);
				i--;
				continue;
			}
			}
			if(temp.getAdviceState()!=null){
			if(temp.getAdviceState().longValue()==2)
			{
				current.remove(i);
				i--;
				continue;
			}
			}
		}
		session.setAttribute("currentDoc",current);
		if(pageNo!=null){
	    	int pageInt;
        	int size=current.size();
        	
        	if(pageNo.equals("last")){
        		
        		pageInt=(size+pageSize-1)/pageSize;
        	}
        	else
        	{      
        		pageInt=Integer.parseInt(pageNo.trim());
        	}
        
        	int index=(pageInt+count-1)/count;
       
        	return showData(pageInt,index,size);
		}
		else{
		int size=current.size();
		if(size>0)
		{
			model=showData(1,1,size);
		}
		else model=showData(1,0,size);	
		}
	return model;
	}
	public ModelAndView showHistory(HttpServletRequest arg0,
			HttpServletResponse arg1) throws Exception
			{
		String docId=new String(RequestUtils.getRequiredStringParameter(arg0, "docId").getBytes("ISO-8859-1"),"MS950");
		String roleid=arg0.getParameter("roleid");
		Long roletype=new Long(Long.parseLong(arg0.getParameter("roletype")));
		List list1=new LinkedList();
        Long step=new Long(Long.parseLong(arg0.getParameter("step")));
//		try{
		  RoleId id=new RoleId();
	         id.setRoleId(roleid);
	         id.setRoleTypeId(roletype);

			list1=dao.getHistoryList(new Long(Long.parseLong(docId)),step);


			//		}
//		catch(Exception e)
//		{
//			String errormessage="read database error";
//			String location="c6.do";
//			Map map=new HashMap();
//			map.put("errormessage",errormessage);
//			map.put("link",location);
//			return new ModelAndView("error.jsp");
//		}
		Map map=new HashMap();
		map.put("history",list1);
		return new ModelAndView("c71history.jsp",map);
	}
	public ModelAndView showChecked(HttpServletRequest arg0,HttpServletResponse arg1)throws Exception
	{
		HttpSession session=arg0.getSession();
		Map map=new HashMap();
		//*****************************************
		//流程ID
		String docId=arg0.getParameter("docId");
		Long step=new Long(Long.parseLong(arg0.getParameter("step")));
		
		FlowUtils utils=new FlowUtils();
    
    	utils.setlimit(10);
    	utils.setname("admin");
    	utils.setpass("admin");
    	utils.setrmi("rmi://localhost:7099/workSessionServer");

		String actionState=null;
		actionState=utils.getAttribute(docId,"ACTION");
////
		boolean limit=false;
		String times="n";
		
		boolean notion=true;
		Long editState=null;
		//根據此id從flow中取得flow?斍伴v卡屬性
		//先取得Action,來判斷顯示何界面
		
		if(actionState==null)
		{
			//顯示?灪隧撁?
			map.put("state",new Integer(1));
			//取得limit的值
			String datelimit=null;
////			datelimit=utils.getAttribute(docId,"DATELIMIT");
////			
			if(datelimit!=null)
			{
				limit=true;
				times="y";
				
				Date date=new Date();
				DateFormat format=new SimpleDateFormat("yyyy-MM-dd");
				String dates=format.format(date);
				int d=Integer.parseInt(dates.substring(0,4));
				d-=1911;
				dates=new Integer(d).toString()+dates.substring(5,7)+dates.substring(8);
				map.put("currentTime",dates);
				
			}
			//设置所有同类型文件的编辑状态
		}
		else if(actionState.equals("REPLY"))
		{
			//顯示申覆?撁?
			map.put("state",new Integer(2));
			//將notion設置為false,无限办日期,无意件
			//设置所有同类型文件的申覆状态
			notion=false;
		}
		else if(actionState.equals("RECEIVE_DOC"))
		{
			//顯示縂收文人收文?撁?
			map.put("state",new Integer(3));
			//將notion設置為false,无限办日期,无意件
			//设置同类型文件的收文状态,收文日期,收文人人名,收文人ID
			notion=false;
		}
		else if(actionState.equals("RECEIVE_DOC_WITH_COMMET"))
		{
			//顯示會?嬝撠熑耸瘴捻撁妫

⌨️ 快捷键说明

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