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

📄 archive.java

📁 一套完整的档案管理系统
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    /**
     * Return the copys.
     */
    public int getCopys() {
	return (this.copys);
    }

    /**
     * Set the copys.
     *
     * @param copys The new copys
     */
    public void setCopys(int copys) {
        this.copys = copys;
    }

    /**
     * Return the lendnum.
     */
    public int getLendnum() {
	return (this.lendnum);
    }

    /**
     * Set the lendnum.
     *
     * @param lendnum The new lendnum
     */
    public void setLendnum(int lendnum) {
        this.lendnum = lendnum;
    }

    /**
     * Return the securityclass.
     */
    public String getSecurityclass() {
		return (this.securityclass);
    }

    /**
     * Set the securityclass.
     *
     * @param securityclass The new securityclass
     */
    public void setSecurityclass(String securityclass) {
        this.securityclass = (securityclass==null)?"":securityclass;
    }

    /**
     * Return the securityterm.
     */
    public int getSecurityterm() {
		return (this.securityterm);
    }

    /**
     * Set the securityterm.
     *
     * @param securityterm The new securityterm
     */
    public void setSecurityterm(int securityterm) {
        this.securityterm = securityterm;
    }

    /**
     * Return the decryptiondate.
     */
    public Date getDecryptiondate() {
		return (this.decryptiondate);
    }

    /**
     * Set the decryptiondate.
     *
     * @param decryptiondate The new decryptiondate
     */
    public void setDecryptiondate(Date decryptiondate) {
        this.decryptiondate = decryptiondate;
    }

    /**
     * Set the decryptiondate.
     *
     * @param decryptiondate The new decryptiondate
     */
    public void setDecryptiondate(String decryptiondate) {
        java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(Constants.DATEFORMAT);
        try {
            this.decryptiondate = sdf.parse(decryptiondate);
        }catch(Exception e) {
        }
    }

    /**
     * Return the retentionperiod.
     */
    public String getRetentionperiod() {
		return (this.retentionperiod);
    }

    /**
     * Set the retentionperiod.
     *
     * @param retentionperiod The new retentionperiod
     */
    public void setRetentionperiod(String retentionperiod) {
        this.retentionperiod = retentionperiod;
    }

    /**
     * Return the archivedate.
     */
    public Date getArchivedate() {
		return (this.archivedate);
    }

    /**
     * Set the archivedate.
     *
     * @param archivedate The new archivedate
     */
    public void setArchivedate(Date archivedate) {
        this.archivedate = archivedate;
    }

    /**
     * Set the archivedate.
     *
     * @param archivedate The new archivedate
     */
    public void setArchivedate(String archivedate) {
        java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(Constants.DATEFORMAT);
        try {
            this.archivedate =sdf.parse(archivedate);
        }catch(Exception e) {
        }
    }

    /**
     * Return the destroydate.
     */
    public Date getDestroydate() {
		return (this.destroydate);
    }

    /**
     * Set the destroydate.
     *
     * @param destroydate The new destroydate
     */
    public void setDestroydate(Date destroydate) {
        this.destroydate = destroydate;
    }

    /**
     * Set the destroydate.
     *
     * @param destroydate The new destroydate
     */
    public void setDestroydate(String destroydate) {
        java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(Constants.DATEFORMAT);
        try {
            this.destroydate = sdf.parse(destroydate);
        }catch(Exception e) {
        }
    }


    /**
     * Return the archivalcode.
     */
    public String getArchivalcode() {
		return (this.archivalcode);
    }

    /**
     * Set the archivalcode.
     *
     * @param archivalcode The new archivalcode
     */
    public void setArchivalcode(String archivalcode) {
        this.archivalcode = (archivalcode==null)?"":archivalcode;
    }

	/**
     * Return the archiveno.
     */
    public String getArchiveno() {
		return (this.archiveno);
    }

    /**
     * Set the archiveno.
     *
     * @param archiveno The new archiveno
     */
    public void setArchiveno(String archiveno) {
        this.archiveno = (archiveno==null)?"":archiveno;
    }

    /**
     * Return the handover.
     */
    public String getHandover() {
		return (this.handover);
    }

    /**
     * Set the handover.
     *
     * @param handover The new handover
     */
    public void setHandover(String handover) {
        this.handover = (handover==null)?"":handover;
    }

    /**
     * Return the suggest.
     */
    public String getSuggest() {
		return (this.suggest);
    }

    /**
     * Set the suggest.
     *
     * @param suggest The new suggest
     */
    public void setSuggest(String suggest) {
        this.suggest = (suggest==null)?"":suggest;
    }

    /**
     * Return the recordtransfer.
     */
    public String getRecordtransfer() {
		return (this.recordtransfer);
    }

    /**
     * Set the recordtransfer.
     *
     * @param recordtransfer The new recordtransfer
     */
    public void setRecordtransfer(String recordtransfer) {
        this.recordtransfer = (recordtransfer==null)?"":recordtransfer;
    }

    /**
     * Return the filingtrace.
     */
    public String getFilingtrace() {
		return (this.filingtrace);
    }

    /**
     * Set the filingtrace.
     *
     * @param filingtrace The new filingtrace
     */
    public void setFilingtrace(String filingtrace) {
        this.filingtrace = (filingtrace==null)?"":filingtrace;
    }

    /**
     * Return the filingscripts.
     */
    public String getFilingscripts() {
		return (this.filingscripts);
    }

    /**
     * Set the filingscripts.
     *
     * @param filingscripts The new filingscripts
     */
    public void setFilingscripts(String filingscripts) {
        this.filingscripts = (filingscripts==null)?"":filingscripts;
    }

    /**
     * Return the reappraisedates.
     */
	
    //public Date getreappraisedates() {
	//	return (this.reappraisedates);
    //}

    /**
     * Set the reappraisedates.
     *
     * @param reappraisedates The new reappraisedates
     */
   // public void setReappraisedates(Date reappraisedates) {
    //    this.reappraisedates = reappraisedates;
    //}
    /**
     * Set the reappraisedates.
     *
     * @param reappraisedates The new reappraisedates
     */
   // public void setReappraisedates(String reappraisedates) {
    //    java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(Constants.DATEFORMAT);
    //    try {
    //        this.reappraisedates = sdf.parse(reappraisedates);
    //    }catch(Exception e) {
     //   }
    //}
	public void setReappraisedates(String reappraisedates) {
        this.reappraisedates = (reappraisedates==null)?"":reappraisedates;
    }

    /**
     * Return the filingscripts.
     */
    public String getreappraisedates() {
		return (this.reappraisedates);
    }
	//2003-05-16 add by liqf,
	
    /**
     * The file that the user has uploaded
     */
    protected FormFile theFile;

    /**
     * The file path to write to
     */
    protected String filePath;



  

    /**
     * Retrieve a representation of the file the user has uploaded
     */
    public FormFile getTheFile() {
        return theFile;
    }

    /**
     * Set a representation of the file the user has uploaded
     */
    public void setTheFile(FormFile theFile) {
        this.theFile = theFile;
    }

   
    /**
     * Set the path to write a file to
     */
    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }

    /**
     * Get the path to write a file to
     */
    public String getFilePath() {
        return filePath;
    }

   

	//对数据的操作.
	public void save(String action,String serialno){
		java.text.SimpleDateFormat sdf1 = new java.text.SimpleDateFormat(Constants.DATEFORMAT);
		Properties dbBase = new Properties();
		dbBase.setProperty("dsJndiName",Constants.DATABASE_KEY);
		STPoolDataSet data = new STPoolDataSet();
			//如果标准单项类的操作类型为更新,则进行以下操作
			if(action.equals("Edit")){
				String sql2="UPDATE  fArchive SET Unitno='"+unitno+"',Title ='"+title+"',FILETYPE='"+filetype+"',";
				sql2+=" LiteratureType='"+literaturetype+"',TitleRemark='"+titleremark+"',code='"+code+"',";
				sql2+=" Category='"+category+"',archivetype='"+archivetype+"',";
				//文件成文日期为空
				if(getFiledate()!=null){
					sql2+=" fileno='"+fileno+"',filedate=cdate('"+sdf1.format(getFiledate())+"'),pagenumber="+pagenumber+",";
				}else{
					sql2+=" fileno='"+fileno+"',pagenumber="+pagenumber+",";
				}
				sql2+=" duty='"+duty+"',otherduty='"+otherduty+"',electronicfilename='"+electronicfilename+"',";
				sql2+=" keyword='"+keyword+"',memo='"+memo+"',annotation='"+annotation+"',";
				sql2+=" abstract='"+abstractmsg+"',lendnum="+lendnum+",securityclass='"+securityclass+"',";
				//销毁成文日期为空
				if(decryptiondate!=null && !decryptiondate.equals("")){
					sql2+=" securityterm='"+securityterm+"',decryptiondate=cdate('"+sdf1.format(decryptiondate)+"'),retentionperiod='"+retentionperiod+"',";
				}else{
					sql2+=" securityterm='"+securityterm+"',retentionperiod='"+retentionperiod+"',";
				}
				//文件成文日期为空
				if(archivedate!=null && !archivedate.equals("")){
					sql2+=" archivedate=cdate('"+sdf1.format(archivedate)+"'),";
				}else{
					sql2+="";
				}
				if(destroydate!=null && !destroydate.equals("")){
					sql2+="destroydate=cdate('"+sdf1.format(destroydate)+"'),archiveno='"+archiveno+"',";
				}else{
					sql2+="archiveno='"+archiveno+"',";
				}
				sql2+=" handover='"+handover+"',suggest='"+suggest+"',archivalcode='"+archivalcode+"',";
				sql2+=" recordtransfer='"+recordtransfer+"',filingtrace='"+filingtrace+"',filingscripts='"+filingscripts+"',";
				if(reappraisedates!=null && !reappraisedates.equals("")){
					//sql2+=" reappraisedates=cdate('"+sdf1.format(reappraisedates)+"'),attachmenttitle='"+attachmenttitle+"'";
					sql2+=" reappraisedates='"+reappraisedates+"',attachmenttitle='"+attachmenttitle+"'";
				}else{
					sql2+=" attachmenttitle='"+attachmenttitle+"'";
				}
				sql2+=",status='"+getStatus()+"'";
				if(getAttachmentpath()!=null && !getAttachmentpath().equals("") && !getAttachmentpath().equals("null")){
					sql2+=",attachmentpath='"+getAttachmentpath()+"'";
				}
				sql2+=" WHERE SERIALNO="+serialno;
				//删除文件
				delFile(serialno,dbBase);
				//执行更新操作
				data.executeSQL(sql2,dbBase);
			}
			//如果单位单项类的操作类型为删除,则进行以下操作
			else if(action.equals("Delete")){
				//删除文件
				delFile(serialno,dbBase);
				//再删除数据库中的数据
				String sql3 = " DELETE  FROM fArchive WHERE SERIALNO="+Integer.parseInt(serialno);
				data.executeSQL(sql3,dbBase);
			}
			//如果单位单项类的操作类型为增加,则进行以下操作
			else if(action.equals("Create")){
				String sql1="INSERT INTO fArchive(Unitno,FlowNo,Deleted,Status,FileType,Title,LiteratureType,ArchiveType,Code,Category,";
				//文件成文日期为空
				if(getFiledate()!=null){
					sql1+=" TitleRemark,FileNo,FileDate,PageNumber,Duty,OtherDuty,ElectronicFileName,KeyWord,Memo,";
				}else{
					sql1+=" TitleRemark,FileNo,PageNumber,Duty,OtherDuty,ElectronicFileName,KeyWord,Memo,";
				}
				//销毁成文日期为空
				if(decryptiondate!=null && !decryptiondate.equals("")){
					sql1+=" Annotation,Abstract,Copys,LendNum,SecurityClass,SecurityTerm,DecryptionDate,RetentionPeriod,";
				}else{
					sql1+=" Annotation,Abstract,Copys,LendNum,SecurityClass,SecurityTerm,RetentionPeriod,";
				}
				//文件成文日期为空
				if(archivedate!=null && !archivedate.equals("")){
					sql1+=" ArchiveDate,";
				}else{
					sql1+="";
				}
				if(destroydate!=null && !destroydate.equals("")){
					sql1+="DestroyDate,";
				}else{
					sql1+="";
				}
				sql1+="ArchiveNo,HandOver,Suggest,RecordTransfer,FilingTrace,FilingScripts,";
				//if(reappraisedates!=null && !reappraisedates.equals("")){
				//	sql1+=" ReAppraiseDates,archivalcode,attachmenttitle,attachmentpath,volumnno) ";
				//}else{
					sql1+=" archivalcode,attachmenttitle,attachmentpath,volumnno) ";
				//}
				sql1+=" VALUES('"+unitno+"','"+flowno+"','0','未归档','"+filetype+"','"+title+"','"+literaturetype+"','"+archivetype+"'";
				//文件成文日期为空
				if(getFiledate()!=null){
					sql1+=" ,'"+code+"','"+category+"','"+titleremark+"','"+fileno+"',cdate('"+sdf1.format(getFiledate())+"'),"+pagenumber+",'"+duty+"','"+otherduty+"'";
				}else{
					sql1+=" ,'"+code+"','"+category+"','"+titleremark+"','"+fileno+"',"+pagenumber+",'"+duty+"','"+otherduty+"'";
				}
				sql1+=" ,'"+electronicfilename+"','"+keyword+"','"+memo+"','"+annotation+"','"+abstractmsg+"',"+copys+","+lendnum+"";
				if(decryptiondate!=null && !decryptiondate.equals("")){
					sql1+=" ,'"+securityclass+"',"+securityterm+",cdate('"+sdf1.format(decryptiondate)+"'),'"+retentionperiod+"'";
				}else{
					sql1+=" ,'"+securityclass+"',"+securityterm+",'"+retentionperiod+"'";
				}
				if(archivedate!=null && !archivedate.equals("")){
					sql1+=",cdate('"+sdf1.format(archivedate)+"'),";
				}else{
					sql1+=",";
				}
				if(destroydate!=null && !destroydate.equals("")){
					sql1+="cdate('"+sdf1.format(destroydate)+"'),";
					
				}else{
					sql1+="";
				}
				//sql1+="cdate('"+sdf1.format(destroydate)+"')";
				sql1+="'"+archiveno+"','"+handover+"','"+suggest+"','"+recordtransfer+"','"+filingtrace+"'";
				sql1+=" ,'"+filingscripts+"',";
				// modify by liqf 
				//if(reappraisedates!=null && !reappraisedates.equals("")){
					//sql1+="	cdate('"+sdf1.format(reappraisedates)+"'),";
				///	sql1+="'"+reappraisedates+"',";
				//}else{
				//	sql1+="";
				//}
				//sql1+=" cdate('"+sdf1.format(reappraisedates)+"'),";
				sql1+="'"+archivalcode+"',";
				sql1+="'"+attachmenttitle+"','"+attachmentpath+"','"+volumnno+"')";
				System.out.println("sql========");
				data.executeSQL(sql1,dbBase);
		    }
	}


	//2003-05-20 add by liqf,
	//对删除的数据做标记
	public void marcketFile(String serialno){
		Properties dbBase = new Properties();
		dbBase.setProperty("dsJndiName",Constants.DATABASE_KEY);
		STPoolDataSet data = new STPoolDataSet();
		String sql="";
		if (serialno!="")
		{
			sql="UPDATE  FARCHIVE SET Deleted='1' WHERE SERIALNO="+serialno;
		}
		data.executeSQL(sql,dbBase);
	}
	//2003-05-25 add by liqf,
	//删除文件
	public void delFile(String serialno,Properties dbBase){
		STPoolDataSet data = new STPoolDataSet();
		String sql3="SELECT AttachmentPath FROM fArchive WHERE SERIALNO="+Integer.parseInt(serialno);
		//System.out.println("sql3=============="+sql3);
		STResultSet rs = data.getSTResult(sql3,dbBase);
		String filename="";
		if(rs.next()){
			filename=rs.getString("AttachmentPath");
			if(filename==null || filename.equals("") || filename.equals("null")){
				filename="";
			}
			System.out.println("filename=============="+filename);
		}
		//先删掉引入的正文和附件
		if(!filename.equals("")){
			int m=filename.lastIndexOf("\\");
			filename=filename.substring(0,m);
			System.out.println("filename=============="+filename);
			java.io.File directory=new java.io.File(filename);
			deleteDirectory(directory);
			//java.io.File f = new java.io.File(filename);
			//	 if (f.exists()) {
			//		 f.delete();
			//	 System.out.println("4444444444444444444444444444");
			//	 }
		}
	}
	//2003-05-25 add by liqf,
	//删除文件夹
	static public void deleteDirectory(java.io.File dir) {
		if( (dir == null) || !dir.isDirectory()){
				System.out.println("Argument "+dir+" is not a directory. ");
			}else{
				java.io.File[ ] entries = dir.listFiles( );
				int sz = entries.length;
				for(int i=0; i<sz; i++) {
					if(entries[i].isDirectory( )) {
						deleteDirectory(entries[i]);
					} else {
						entries[i].delete( );
					}
				}
				dir.delete();
			}
	} 

	//2003-05-26 add by liqf,
	//填写操作日志
	public void writeLog(String serialno,Properties dbBase){
		java.text.SimpleDateFormat sdf1 = new java.text.SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
		STPoolDataSet data = new STPoolDataSet();
		String sql3="insert into fhandlelog(EnterName,UserName,HandleTime,HandleContent)";
		if(getHandletime()!=null){
			sql3+=" values('"+entername+"','"+username+"',cdate('"+sdf1.format(getHandletime())+"'),'"+handlecontent+"')";
		}else{
			sql3+=" values('"+entername+"','"+username+"',null,'"+handlecontent+"')";
		}
		data.executeSQL(sql3,dbBase);
	}

}

⌨️ 快捷键说明

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