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

📄 volumnfilesearchaction.java

📁 一套完整的档案管理系统
💻 JAVA
字号:
package com.stsc.archive.backup;//modify

import com.stsc.archive.second.fileinfoForm;//add,lxm
import com.stsc.archive.second.FileKind;//add,lxm
import com.stsc.archive.second.FileKindList;//add,lxm

import javax.servlet.http.*;
import org.apache.struts.action.*;
import java.util.Properties;

import org.apache.struts.util.MessageResources;
import com.stsc.util.STPoolDataSet;
import com.stsc.util.STResultSet;
import java.util.Date;
import java.text.SimpleDateFormat;
//import java.text.ParseException;
import com.stsc.archive.manage.*;//----------增加-------------------
//import com.stsc.archive.file.Constants;

public final class volumnFilesearchAction extends Action
{
	public String Iso2Gb(String str)
     {
           String ret=(str==null) ? "" : str;
        // try
       // {
        // byte[] byteStr=str.getBytes("ISO-8859-1");
        // return new String(byteStr,"gb2312");
       // }
        // catch(Exception e)
       //{
         return ret;
       //}
      }
	public ActionForward perform(ActionMapping mapping, ActionForm form,
	       HttpServletRequest req,HttpServletResponse res)
	{
		//----选择文件的SQL语句-----------------------------------------------------------------
		String archivetype=req.getParameter("archivetype");
	        //System.out.println(Iso2Gb(archivetype));		
	        String volumnno=req.getParameter("volumnno");
		 //System.out.println(Iso2Gb(volumnno));      
	        String volumntitle=req.getParameter("volumntitle");
			
	        String code=req.getParameter("code");
	       
			
                String category=req.getParameter("category");
			
	        String retentionperiod=req.getParameter("retentionperiod");
			
	        String startdate=req.getParameter("startdate");
			
	        String enddate=req.getParameter("enddate");
			
	        String totalnum=req.getParameter("totalnum");
			
	        String totalpage=req.getParameter("totalpage");
			
	        String duty=req.getParameter("duty");
			
	        String security=req.getParameter("security");
			
	        String archiveunit=req.getParameter("archiveunit");
			
	        String remark=req.getParameter("remark");
			
	        String status=req.getParameter("status");
	        String sql="";
			
		HttpSession session=req.getSession();
		User userInfo=(User)session.getAttribute(Constants.CURRENT_USER_KEY);//----------增加------------
	        boolean info=userInfo.hasPopedom(4);//--------增加-------------------
	        boolean info1=userInfo.hasPopedom(5);//-----------增加------------------------


	       if(archivetype.equals("") == true && volumnno.equals("") == true && volumntitle.equals("") == true && code.equals("") == true && category.equals("") == true && retentionperiod.equals("") == true && startdate.equals("") == true && enddate.equals("") == true && totalnum.equals("") == true && totalpage.equals("") == true && duty.equals("") == true && security.equals("") == true && archiveunit.equals("") == true && remark.equals("") == true && status.equals("") == true)
	         {  
	         	
	                sql="SELECT * FROM fVolumn where Deleted<>'1'";
	           }
	       else{
	                sql="SELECT * FROM fVolumn where Deleted<>'1'";
	           }
	        //System.out.println(sql);
	        //-------改过-------------
	        
	         if(security!=null && security.equals("") == false)
	        { 
	        	sql+="AND Security='" + Iso2Gb(security)+"'";
	        }
	        else{
	                if(info==false && info1==false)
	                {
	                	sql+="And Security='普通'";
	                }
	                else if(info==true && info1==false)
	                {
	                	sql+="And Security<>'机密'";
	                }
	        }//----------------改完---------------------
	        
	        if(archivetype!=null && archivetype.equals("") == false)
	        {
	        	sql+="And ArchiveType='" + Iso2Gb(archivetype) +"'";
	        }
	        	        
	         if(volumnno!=null && volumnno.equals("") == false)
	        { 
	        	sql+="And VolumnNo='" + Iso2Gb(volumnno)+"'";
	        }
	       
	        if( volumntitle!=null && volumntitle.equals("") == false)
	        { 
	        	sql+="And VolumnTitle='" + Iso2Gb(volumntitle)+"'";
	        }
	        
	        if(code!=null && code.equals("") == false)
	        { 
	        	sql+="And Code='" + Iso2Gb(code)+"'";
	        }
	        
	        if(category!=null && category.equals("") == false)
	        { 
	        	sql+="And Category='" + Iso2Gb(category)+"'";
	        }
	        
	        if(retentionperiod!=null && retentionperiod.equals("") == false)
	        { 
	        	sql+="And RetentionPeriod='" + Iso2Gb(retentionperiod)+"'";
	        }
	        
	        if(startdate!=null && startdate.equals("") == false)
	        { 
	        	sql+="And StartDate=cdate('" + Iso2Gb(startdate)+"')";
	        }
	        
	        if(enddate!=null && enddate.equals("") == false)
	        { 
	        	sql+="And EndDate=cdate('" + Iso2Gb(enddate)+"')";
	        }
	        
	        if(totalnum!=null && totalnum.equals("") == false)
	        { 
	        	
	        	sql+="And TotalNum=" + Integer.parseInt(totalnum);
	        }
	        
	        if(totalpage!=null && totalpage.equals("") == false)
	        { 
	        	
	        	sql+="And TotalPage=" + Integer.parseInt(totalpage);
	        }
	       
	        if(duty!=null && duty.equals("") == false)
	        { 
	        	sql+="And Duty='" + Iso2Gb(duty)+"'";
	        }
	        
	       
	        
	        if(archiveunit!=null && archiveunit.equals("") == false)
	        { 
	        	sql+="And ArchiveUnit='" + Iso2Gb(archiveunit)+"'";
	        }
	       
	        if(remark!=null && remark.equals("") == false)
	        { 
	        	sql+="And Remark='" + Iso2Gb(remark)+"'";
	        }
	        
	        if(status!=null && status.equals("") == false)
	        { 
	        	sql+="And Status='" + Iso2Gb(status)+"'";
	        }
	       
		//------------------------------------------------------------------------
		System.out.println(sql);
		Properties dbBase= new Properties();
		dbBase.setProperty("dsJndiName", Constants.ARCHIVE_DBSOURCE_KEY);
		STPoolDataSet data=new STPoolDataSet();
		
		STResultSet rs=data.getSTResult(sql,dbBase);
		//------------数据类型的转化还没进行
		SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM");
		String startdate2=null;
		String enddate2=null;
		//-------------------------------------增加---------
		String[] volumnid1=new String[rs.getRecCount()];
		System.out.println(rs.getRecCount());
		int i=0;                              
		String[] m=new String[rs.getRecCount()];
		
		FileKindList shore=new FileKindList();
		//System.out.println("怎么回事");
		while(rs!=null && rs.next())
		{ 
			
			//---把自动编号存进数组---------------
			volumnid1[i]=Integer.toString(rs.getInt("VolumnID"));//--------------增加--------------
			
			i++;//-----------------增加--------------
			
			//------成功存入----------------------
			
			FileKind filename=new FileKind();
			
			filename.setarchivetype(rs.getString("ArchiveType"));
			
		        filename.setvolumnno(rs.getString("VolumnNo"));
		        //System.out.println(rs.getString("VolumnNo"));
			filename.setvolumntitle(rs.getString("VolumnTitle"));
			
			filename.setcode(rs.getString("Code"));
			
			filename.setcategory(rs.getString("Category"));
			
			filename.setretentionperiod(rs.getString("RetentionPeriod"));
			
		       // System.out.println(rs.getDate("StartDate"));
		        //System.out.println(rs.getDate("EndDate"));
		        
		       //if((rs.getDate("StartDate").equals("")==true||rs.getDate("StartDate")==null) &&(rs.getDate("EndDate").equals("")==true||rs.getDate("EndDate")==null))
		      if(rs.getDate("StartDate")==null && rs.getDate("EndDate")==null)
		       {
		       	        startdate2="0";
		       	        enddate2="0";
		       	        // System.out.println("进入if语句");
		       	}
		       
		         //else if((rs.getDate("StartDate"))==null||(rs.getDate("StartDate")).equals("")==true)
		         else if(rs.getDate("StartDate")==null && rs.getDate("EndDate")!=null)
		         {
		         	startdate2="0";
		         	 enddate2=sdf.format(rs.getDate("EndDate"));
		         	 //System.out.println("进入else if语句");
		         }
		        
		         //else if((rs.getDate("EndDate"))==null||(rs.getDate("EndDate")).equals("")==true)
		         else if(rs.getDate("EndDate")==null && rs.getDate("StartDate")!=null)
		         {
		         	enddate2="0";
		         	startdate2=sdf.format(rs.getDate("StartDate"));
		         	//System.out.println("进入else if语句");
		         }
		         
		        else
		        {
			 startdate2=sdf.format(rs.getDate("StartDate"));
			 enddate2=sdf.format(rs.getDate("EndDate"));
			// System.out.println(rs.getDate("StartDate"));
			}
		       //System.out.println("进入if后一步语句");
		
			filename.setstartdate(startdate2);
			
			filename.setenddate(enddate2);
			 
			filename.settotalnum(Integer.toString(rs.getInt("TotalNum")));
			//System.out.println("filename.getdeleted()");
			filename.settotalpage(Integer.toString(rs.getInt("TotalPage")));
			
			filename.setduty(rs.getString("Duty"));
			
			filename.setsecurity(rs.getString("Security"));
			
			filename.setarchiveunit(rs.getString("ArchiveUnit"));
			
			filename.setremark(rs.getString("Remark"));
			
			filename.setstatus(rs.getString("Status"));
			
			filename.setvolumnid(rs.getInt("VolumnID"));
			
			filename.setdeleted(rs.getString("Deleted"));
		       
			shore.addFileName(filename);
			
			
		}
		//System.out.println("出了while语句");
		//HttpSession session=req.getSession();
		session.setAttribute("myhashtable",shore);
		session.setAttribute("my",sql);
		session.setAttribute("save",volumnid1);//---------------增加---------------------
		session.setAttribute("index",Integer.toString(i));//-------------增加-----------------
		
		
		System.out.println("出了filesearchAction.java 123");
		return mapping.findForward("success");
	}
}
  
		

⌨️ 快捷键说明

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