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

📄 fileinfoaction.java

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

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;
public final class fileinfoAction extends Action
{
	
      public ActionForward perform(ActionMapping mapping, ActionForm form,
             HttpServletRequest req,HttpServletResponse res)
      {
      	
      	translate m=new translate();
      	//SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM");
      	Properties dbBase= new Properties();
      	dbBase.setProperty("dsJndiName", Constants.ARCHIVE_DBSOURCE_KEY);
	STPoolDataSet data=new STPoolDataSet();
        //建立session
	HttpSession session = req.getSession();
	
	//取得表单的数据
      	 String archivetype=req.getParameter("archivetype");
         String volumnno=req.getParameter("volumnno");
	 String volumntitle=req.getParameter("volumntitle");
	 String code=req.getParameter("code");
	 //把工程代号补足4位
	 if(code.length()<4)
	 {
	 	for(int i=0;i<4;i++)
	 	{
	 		if(code.length()<4)
	 		{
	 			code="0"+code;
	 			System.out.println(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 totalnum=((fileinfoForm)form).gettotalnum();
	 //String totalpage=req.getParameter("totalpage");
	 String totalpage=((fileinfoForm)form).gettotalpage();
	 System.out.println(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 check=req.getParameter("check");
	 String check1=m.Iso2Gb(check);
	 String save=req.getParameter("save");
	// String save1=m.Iso2Gb(save);
	 String save1=save;
	 System.out.println(m.Iso2Gb(save));
	
	 String sql="";
	 String sql1="SELECT * FROM fVolumn WHERE VolumnNo='" +m.Iso2Gb(volumnno) + "'";
	 System.out.println(sql1);
	 //把archivetype存到session中去
	 /*
	 session.setAttribute("archivetype",archivetype);
        System.out.println(session.getAttribute("archivetype"));*/
        
	 STResultSet rs1=data.getSTResult(sql1,dbBase);
	
	 
	if( rs1.next())
	{
		System.out.println("进入if语句");
		return mapping.findForward("success3");
	}
	else{ 
	 System.out.println("进入else语句");
	 
	 if((startdate!=null || startdate.equals("")==false) && (enddate!=null || enddate.equals("")==false))
	{
		 sql="INSERT INTO fVolumn (Deleted,ArchiveType,VolumnNo,VolumnTitle,Code,Category,RetentionPeriod,StartDate,EndDate,TotalNum,TotalPage,Duty,Security,Remark,Status,archiveunit) VALUES(0,'" 
	        + m.Iso2Gb(archivetype)+"','" +m.Iso2Gb(volumnno)+"','" +m.Iso2Gb(volumntitle)+"','" +m.Iso2Gb(code)+"','" +m.Iso2Gb(category)+"','" +m.Iso2Gb(retentionperiod)+"',cdate('" +m.Iso2Gb(startdate)+"'),cdate('" + m.Iso2Gb(enddate)+ "')," +Integer.parseInt(totalnum)+"," +Integer.parseInt(totalpage)+ ",'" +m.Iso2Gb(duty)+"','" +m.Iso2Gb(security)+ "','" +m.Iso2Gb(remark)+"','" +m.Iso2Gb(status)+"','"+m.Iso2Gb(archiveunit)+"')";

	}
	
	 if((startdate==null || startdate.length()<1 ) &&  (enddate==null ||enddate.length() <1))
	 
	 {
	  sql="INSERT INTO fVolumn (Deleted,ArchiveType,VolumnNo,VolumnTitle,Code,Category,RetentionPeriod,TotalNum,TotalPage,Duty,Security,Remark,Status,archiveunit) VALUES(0,'"+m.Iso2Gb(archivetype)+"','" +m.Iso2Gb(volumnno)+"','" +m.Iso2Gb(volumntitle)+"','"
	   + m.Iso2Gb(code)+"','" +m.Iso2Gb(category)+"','" +m.Iso2Gb(retentionperiod)+"',"+Integer.parseInt(totalnum)+"," +Integer.parseInt(totalpage)+ ",'" +m.Iso2Gb(duty)+"','" +m.Iso2Gb(security)+ "','" +m.Iso2Gb(remark)+"','" +m.Iso2Gb(status)+"','"+m.Iso2Gb(archiveunit)+"')";
	 }		
	 
	 //else if(startdate==null)
	else
      {
		if(startdate==null || startdate.length() < 1 )
	 {
	 	  sql="INSERT INTO fVolumn (Deleted,ArchiveType,VolumnNo,VolumnTitle,Code,Category,RetentionPeriod,EndDate,TotalNum,TotalPage,Duty,Security,Remark,Status) VALUES(0,'" 
	        + m.Iso2Gb(archivetype)+"','" +m.Iso2Gb(volumnno)+"','" +m.Iso2Gb(volumntitle)+"','" +m.Iso2Gb(code)+"','" +m.Iso2Gb(category)+"','" +m.Iso2Gb(retentionperiod)+"',cdate('" + m.Iso2Gb(enddate)+ "')," +Integer.parseInt(totalnum)+"," +Integer.parseInt(totalpage)+ ",'" +m.Iso2Gb(duty)+"','" +m.Iso2Gb(security)+ "','" +m.Iso2Gb(remark)+"','" +m.Iso2Gb(status)+"')";
	 }
	 //else if(enddate==null)
	 else if(enddate==null ||enddate.length() <1   )
	{
		  sql="INSERT INTO fVolumn (Deleted,ArchiveType,VolumnNo,VolumnTitle,Code,Category,RetentionPeriod,StartDate,TotalNum,TotalPage,Duty,Security,Remark,Status) VALUES(0,'" 
	        + m.Iso2Gb(archivetype)+"','" +m.Iso2Gb(volumnno)+"','" +m.Iso2Gb(volumntitle)+"','" +m.Iso2Gb(code)+"','" +m.Iso2Gb(category)+"','" +m.Iso2Gb(retentionperiod)+"',cdate('" +m.Iso2Gb(startdate)+"')," +Integer.parseInt(totalnum)+"," +Integer.parseInt(totalpage)+ ",'" +m.Iso2Gb(duty)+"','" +m.Iso2Gb(security)+ "','" +m.Iso2Gb(remark)+"','" +m.Iso2Gb(status)+"')";
	}
      }
	
	
	  //System.out.println(sql);
	
	 data.executeSQL(sql,dbBase);
	 //System.out.println("数据保存进去了");
	 if(save1.equals("保存并返回首页"))
	 {
	 	//System.out.println("进入if语句");
	 	System.out.println("保存并返回首页按钮");
	 	return mapping.findForward("success");
	 }
	 else if(save.equals("保存并继续添加"))
	 {
	// System.out.println("保存并继续添加");
	 //System.out.println("出了fileinfoAction.java 123");
	    if(check1.equals("0"))
	   { 
	      ((fileinfoForm)form).setarchivetype(m.Iso2Gb(archivetype));
	
	      ((fileinfoForm)form).setvolumnno(m.Iso2Gb(volumnno));
	
	      ((fileinfoForm)form).setvolumntitle(m.Iso2Gb(volumntitle));
	
	      ((fileinfoForm)form).setcode(m.Iso2Gb(code));
	
	      ((fileinfoForm)form).setcategory(m.Iso2Gb(category));
	
	      ((fileinfoForm)form).setretentionperiod(m.Iso2Gb(retentionperiod));
	
	      ((fileinfoForm)form).setstartdate(m.Iso2Gb(startdate));
	
	      ((fileinfoForm)form).setenddate(m.Iso2Gb(enddate));
	
	      ((fileinfoForm)form).settotalnum(m.Iso2Gb(totalnum));
	
	      ((fileinfoForm)form).settotalpage(m.Iso2Gb(totalpage));
	
	      ((fileinfoForm)form).setduty(m.Iso2Gb(duty));
	
	      ((fileinfoForm)form).setsecurity(m.Iso2Gb(security));
	
	      ((fileinfoForm)form).setarchiveunit(m.Iso2Gb(archiveunit));
	
	      ((fileinfoForm)form).setremark(m.Iso2Gb(remark));
	 
	      ((fileinfoForm)form).setstatus(m.Iso2Gb(status));
	      
	      //System.out.println("出了fileinfoAction.java 123");
	      
	      return mapping.findForward("success1");
	    }
	  else{
	     ((fileinfoForm)form).reset( mapping, req);
	     return mapping.findForward("success1");
	     }
	
      	}
		//2003-05-28 add by liqf
		//forward
	else{
			//HttpSession session = req.getSession();
		 fileinfoForm archiveform1 = (fileinfoForm)form;
			//档案种类
			archiveform1.setarchivetype(m.Iso2Gb(archivetype));
			//案卷号
	      archiveform1.setvolumnno(m.Iso2Gb(volumnno));
			//工程代号
	      archiveform1.setcode(m.Iso2Gb(code));
			//保管期限
	      archiveform1.setretentionperiod(m.Iso2Gb(retentionperiod));
		  //密级
		  archiveform1.setsecurity(m.Iso2Gb(security));
		  //类目号
		  archiveform1.setcategory(m.Iso2Gb(category));
		 session.setAttribute("fileinfoForm",archiveform1);
		 
		 
			return mapping.findForward("success2");
		}
      	
      }
	  }
}
	
	
	 

⌨️ 快捷键说明

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