📄 savearchiveaction.java
字号:
archiveform2.setSuggest(s27);
archiveform2.setRecordtransfer(s28);
archiveform2.setFilingtrace(s29);
archiveform2.setFilingscripts(s30);
archiveform2.setReappraisedates(s31);
httpsession.setAttribute("archiveForm", archiveform2);
if(actionform instanceof ArchiveForm)
{
ArchiveForm archiveform1 = (ArchiveForm)actionform;
FormFile formfile = archiveform1.getTheFile();
String s32 = formfile.getFileName();
System.out.println("s32======================="+s32);
if(s32 != null && !s32.equals("") && !s32.equals("null"))
{
s32 = Iso2Gb(s32);
String s34 = formfile.getContentType();
System.out.println("s34======================="+s34);
SimpleDateFormat simpledateformat = new SimpleDateFormat("yyyyMMddhhmmss");
SimpleDateFormat simpledateformat1 = new SimpleDateFormat("yyyy");
String s35 = simpledateformat.format(new Date());
String s355=simpledateformat1.format(new Date());
s35=s355+"\\"+s35;
String s36 = "";
//组合备份路径
if(saveroute!=null && !saveroute.equals("")){
//判断是否输入正确
int m=saveroute.lastIndexOf("\\");
m=m+1;
if(m!=saveroute.length()){
saveroute=saveroute+"\\";
}
s36=saveroute + s35;
//System.out.println("s36==============================="+s36);
}else{
//s36="testtest\\" + s35;
s36=s35;
}
String s37 = Mkdir(s36);
//System.out.println("s36==============================="+s36);
if(s37.equals("9"))
{
archive.setAttachmentpath(s36 + "\\" + s32);
//System.out.println("s36==============================="+s36);
s32 = s36 + "\\" + s32;
//System.out.println("s32==============================="+s32);
try
{
ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
InputStream inputstream = formfile.getInputStream();
FileOutputStream fileoutputstream = new FileOutputStream(s32);
int j1 = 0;
byte abyte0[] = new byte[8192];
while((j1 = inputstream.read(abyte0, 0, 8192)) != -1)
fileoutputstream.write(abyte0, 0, j1);
fileoutputstream.close();
inputstream.close();
}
catch(FileNotFoundException filenotfoundexception)
{
return null;
}
catch(IOException ioexception)
{
return null;
}
formfile.destroy();
}
}
}
archive.save(s, s1);
String s33 = "SELECT * FROM FARCHIVE";
//write handlelog
if(s.equals("Edit")){
archive.writeLog(s1,properties);
String[] temp=(String[]) httpsession.getAttribute("temp");
if(temp!=null ){
s33="SELECT * FROM FARCHIVE WHERE serialno in(";
for(i=0;i<temp.length-1;i++){
//System.out.println("temp[i]=============================="+temp[i]);
if(temp[i]!=null && !temp[i].equals("") && !temp[i].equals("null")){
s33+=Integer.parseInt(temp[i])+",";
}
}
if(temp[i]!=null && !temp[i].equals("") && !temp[i].equals("null")){
s33=s33+Integer.parseInt(temp[temp.length-1]);
}
s33=s33+")";
}
}
//2003-05-28 add by liqf
//将查询所用sql置入session
//第一次进入,未翻页之前
String currentpage=(String)httpservletrequest.getParameter("currentpage");
if(currentpage==null || currentpage.equals("") || currentpage.equals("null")){
httpsession.setAttribute("searchsql_new",s33);
}
if(currentpage!=null && !currentpage.equals("") && !currentpage.equals("null")){
s33=(String)httpsession.getAttribute("searchsql_new");
}
//2003-06-07 add by liqf
//增加分页处理
// STResultSet rs=data.getSTResult(sql1,dbBase);
STResultSet stresultset = stpooldataset.getSTResult(s33, properties);
long data_num=stresultset.getRecCount();
//System.out.println("data_num====="+data_num);
long Current_Page = 0;
PageCt PageCt=new PageCt();
if (currentpage != null && !currentpage.equals("") && !currentpage.equals(""))
{
Current_Page = Integer.parseInt(httpservletrequest.getParameter("currentpage"));
}
String Query_Page=(String)httpservletrequest.getParameter("Query_Page");
if (Query_Page!=null && !Query_Page.equals(""))
{
Current_Page = Integer.parseInt(httpservletrequest.getParameter("Query_Page"))-1;
}
PageCt.Init(Current_Page,data_num,httpsession);
long l_start = PageCt.getStart();
//System.out.println("l_start==================="+l_start);
long l_end = PageCt.getEnd();
//System.out.println("l_end==================="+l_end);
long i2=0;
//System.out.println("PageCt==================="+PageCt.getTotalnum());
while((i2<l_start) && stresultset.next())
{
i2++;
}
long j1=0;
Archive archive1;
String temp_attachmentpath="";
//for(stresultset = stpooldataset.getSTResult(s33, properties); stresultset != null && stresultset.next(); archivelist.addArchive(archive1))
//{
while(stresultset!=null && stresultset.next() && (i2<l_end))
{
j1=i2+1;
archive1 = new Archive();
temp_attachmentpath=stresultset.getString("attachmentpath");
temp_attachmentpath=temp_attachmentpath.replace('\\', '/');
archive1.setAttachmentpath(temp_attachmentpath);
archive1.setUnitno(stresultset.getString("unitno"));
archive1.setUnitno(stresultset.getString("unitno"));
archive1.setDeleted(stresultset.getString("flowno"));
archive1.setDeleted(stresultset.getString("Deleted"));
archive1.setVolumnno(stresultset.getString("volumnno"));
archive1.setSerialno(stresultset.getInt("SERIALNO"));
archive1.setStatus(stresultset.getString("Status"));
archive1.setArchivetype(stresultset.getString("ARCHIVETYPE"));
archive1.setCode(stresultset.getString("CODE"));
archive1.setCategory(stresultset.getString("CATEGORY"));
archive1.setFiletype(stresultset.getString("FILETYPE"));
archive1.setTitle(stresultset.getString("TITLE"));
archive1.setTitleremark(stresultset.getString("TITLEREMARK"));
archive1.setFileno(stresultset.getString("FILENO"));
archive1.setLiteraturetype(stresultset.getString("LITERATURETYPE"));
archive1.setFiledate(stresultset.getDate("FILEDATE"));
archive1.setPagenumber(stresultset.getInt("PAGENUMBER"));
archive1.setDuty(stresultset.getString("DUTY"));
archive1.setOtherduty(stresultset.getString("OTHERDUTY"));
archive1.setElectronicfilename(stresultset.getString("ELECTRONICFILENAME"));
archive1.setAttachmenttitle(stresultset.getString("ATTACHMENTTITLE"));
archive1.setKeyword(stresultset.getString("KEYWORD"));
archive1.setMemo(stresultset.getString("MEMO"));
archive1.setAnnotation(stresultset.getString("ANNOTATION"));
archive1.setAbstractmsg(stresultset.getString("ABSTRACT"));
archive1.setCopys(stresultset.getInt("COPYS"));
archive1.setLendnum(stresultset.getInt("LENDNUM"));
archive1.setSecurityclass(stresultset.getString("SECURITYCLASS"));
archive1.setSecurityterm(stresultset.getInt("SECURITYTERM"));
archive1.setDecryptiondate(stresultset.getDate("DECRYPTIONDATE"));
//modify by liqf 2003-06-03
//archive1.setRetentionperiod(stresultset.getInt("RETENTIONPERIOD"));
archive1.setRetentionperiod(stresultset.getString("RETENTIONPERIOD"));
archive1.setFlowno(stresultset.getString("FLOWNO"));
///System.out.println("stresultset.getString===="+stresultset.getString("RETENTIONPERIOD"));
archive1.setArchivedate(stresultset.getDate("ARCHIVEDATE"));
archive1.setDestroydate(stresultset.getDate("DESTROYDATE"));
archive1.setArchivalcode(stresultset.getString("ARCHIVALCODE"));
archive1.setArchiveno(stresultset.getString("ARCHIVENO"));
archive1.setHandover(stresultset.getString("HANDOVER"));
archive1.setSuggest(stresultset.getString("SUGGEST"));
archive1.setRecordtransfer(stresultset.getString("RECORDTRANSFER"));
archive1.setFilingtrace(stresultset.getString("FILINGTRACE"));
archive1.setFilingscripts(stresultset.getString("FILINGSCRIPTS"));
archive1.setReappraisedates(stresultset.getString("REAPPRAISEDATES"));
archivelist.addArchive(archive1);
i2++;
}
//2003-06-07 add by liqf
//增加分页处理
httpsession.setAttribute("PageCt", PageCt);
httpsession.setAttribute("archivelist", archivelist);
if(!actionerrors.empty())
{
saveErrors(httpservletrequest, actionerrors);
return new ActionForward(actionmapping.getInput());
} else
{
System.out.println("mapping.findForward(\"success\")=" + actionmapping.findForward("success"));
//System.out.println("button================="+button);
if(b2.equals("保存并继续添加") && !button.equals("保存并继续添加")){
//System.out.println("button111================="+button);
return actionmapping.findForward("success2");
//System.out.println("button111================="+button);
}
else if(button.equals("保存并继续添加")){
//System.out.println("button111================="+button);
return actionmapping.findForward("success1");
//System.out.println("button111================="+button);
}else if(button.equals("生成电子档号")){
//System.out.println("button111================="+button);
return actionmapping.findForward("success3");
//System.out.println("button111================="+button);
}else {
return actionmapping.findForward("success");
}
}
}
//2003-06-03 add by liqf
//生成归档号(即存址号)的方法
/*参数说明如下:
archivetype:为档案种类
code :为文件年代或者工程代号或者载体代号
noweyear :为文件年代,文件形成的年代
option :判断为何种文件类型,1:行政文件,2:党务文件,3:其他文件。
volumnno :案卷号
unitno :件号
filetype :文件种类,或者载体种类
*/
public String toElcno(String archivetype,String code,String nowyear,String option,String unitno,String categray,String volumnno,String filetype){
String elecno="";
String sql="";
int serino=0;
STPoolDataSet data= new STPoolDataSet();
STResultSet ms=null;
Properties properties = new Properties();
properties.setProperty("dsJndiName", Constants.DATABASE_KEY);
//生成各档案的归档号(即存址号)
//文件归档号:文件年代(四位)+""+文件类型(一位)+流水件号(四位);
if(archivetype.equals("文档") || archivetype.equals("文书档案")){
sql="select max(archivalcode) from fArchive where archivetype='文档'";
sql+=" and FileDate>=cdate('"+nowyear+"-01-01"+"') and FileDate<=cdate('"+nowyear+"-12-31"+"')";
//从数据库中查询出流水号
ms=data.getSTResult(sql,properties);
if(ms!=null){
ms.next();
String maxarchivalcode=ms.getString(1);
if(!maxarchivalcode.equals("") && maxarchivalcode.length()>=6){
maxarchivalcode=maxarchivalcode.substring(6);
}else{
maxarchivalcode="0";
}
int temp_int=Integer.parseInt(maxarchivalcode);
//temp_int=temp_int+1;
elecno=nowyear+"-"+option+toFlowno_4(temp_int);
}else{
elecno=nowyear+"-"+option+"0001";
}
//转化为字符串
//elecno=""+toFlowno_4(temp_int);
//elecno=nowyear+"-"+option+toFlowno_4(temp_int);
System.out.println("文档==============================="+elecno);
}
//科技档案归档号:工程代号(四位)+"-"+类目号(四位)+""+流水卷号(三位)+""+件号(三位)
if(archivetype.equals("科档") || archivetype.equals("科技档案")){
if(!volumnno.equals("")){
sql="select max(archivalcode) from fArchive where archivetype='科档'";
sql+=" and FileDate>=cdate('"+nowyear+"-01-01"+"') and FileDate<=cdate('"+nowyear+"-12-31"+"')";
//从数据库中查询出流水号
ms=data.getSTResult(sql,properties);
String last_maxarchivalcode="";
if(ms!=null){
ms.next();
String maxarchivalcode=ms.getString(1);
if(!maxarchivalcode.equals("") && maxarchivalcode.length()>=13){
last_maxarchivalcode=maxarchivalcode.substring(0,13);
System.out.println("maxarchivalcode1111=========================="+maxarchivalcode);
maxarchivalcode=maxarchivalcode.substring(13);
}else {
if(volumnno.length()>=13){
maxarchivalcode="0";
last_maxarchivalcode=volumnno.substring(0,13);
}else{
maxarchivalcode="0";
}
}
System.out.println("maxarchivalcode22222=========================="+maxarchivalcode);
int temp_int=Integer.parseInt(maxarchivalcode);
System.out.println("temp_int=========================="+temp_int);
//temp_int=temp_int+;
elecno=last_maxarchivalcode+"-"+toFlowno_3(temp_int);
///System.out.println("11111111111=========================="+elecno);
}else{
if(volumnno.length()>=10){
elecno=volumnno.substring(0,10)+"-"+"001";
//System.out.println("22222222=========================="+elecno);
}
}
//System.out.println("科档==========="+elecno);
}else{
elecno=toChat_4(code)+"-"+toChat_4(categray)+"-"+"001"+"-"+toChat_3(unitno);
//System.out.println("科档==========="+elecno);
}
}
//会计档案归档号:类目号(四位)+"("+文件年代(四位,或者工程代码)+")-"+流水卷号(三位)+""+件号(三位)
if(archivetype.equals("会档") || archivetype.equals("会计档案")){
if(!volumnno.equals("")){
elecno=toChat_4(categray)+"("+nowyear+")-"+volumnno.substring(10,13)+toChat_3(unitno);
System.out.println("会档----------------------------"+elecno);
}else{
sql="select max(archivalcode) from fArchive where archivetype='会档'";
sql+=" and FileDate>=cdate('"+nowyear+"-01-01"+"') and FileDate<=cdate('"+nowyear+"-12-31"+"')";
ms=data.getSTResult(sql,properties);
String last_maxarchivalcode="";
if(ms!=null){
ms.next();
String maxarchivalcode=ms.getString(1);
if(!maxarchivalcode.equals("") && maxarchivalcode.length()>=14){
last_maxarchivalcode=maxarchivalcode.substring(11,14);
}else{
last_maxarchivalcode="0";
}
int temp_int=Integer.parseInt(last_maxarchivalcode);
//temp_int=temp_int+1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -