抵押档案归档

This commit is contained in:
user 2018-06-07 14:38:59 +08:00
parent d8507df113
commit 0a61b7cdd1
3 changed files with 185 additions and 1 deletions

View File

@ -0,0 +1,86 @@
<%@page import="java.net.URLDecoder"%>
<%@page import="com.amarsoft.are.jbo.impl.BizObjectTableMapper"%>
<%@page import="com.amarsoft.awe.util.DBKeyHelp"%>
<%@page import="com.amarsoft.awe.common.attachment.*"%>
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/IncludeBegin.jsp"%><%
AmarsoftUpload myAmarsoftUpload = new AmarsoftUpload();
myAmarsoftUpload.initialize(pageContext);
myAmarsoftUpload.upload();
String FileSizejs=(String)myAmarsoftUpload.getRequest().getParameter("FileSize2");
String docType=(String)myAmarsoftUpload.getRequest().getParameter("DOC_TYPE");
String oneClassfiy=(String)myAmarsoftUpload.getRequest().getParameter("ONE_CLASSIFY");
String twoClassfiy=(String)myAmarsoftUpload.getRequest().getParameter("TWO_CLASSIFY");
String objectType=(String)myAmarsoftUpload.getRequest().getParameter("OBJECTTYPE");
// String sFileName =URLDecoder.decode((String)myAmarsoftUpload.getRequest().getParameter("FILENAMEX"),"UTF-8"); //文件名称
String sFileName = myAmarsoftUpload.getFiles().getFile(0).getFileName();
// System.out.println("文件名==="+ URLDecoder.decode((String)myAmarsoftUpload.getRequest().getParameter("FILENAMEX"),"UTF-8"));
// String Remark=URLDecoder.decode((String)myAmarsoftUpload.getRequest().getParameter("REMARK2"),"UTF-8"); //备注InputTime
String Remark= (String)myAmarsoftUpload.getRequest().getParameter("REMARK"); //备注InputTime
String libraryId= (String)myAmarsoftUpload.getRequest().getParameter("ID"); //附件编号
String InputTime= StringFunction.getTodayNow(); //附件编号上传时间
BizObjectManager libBm=JBOFactory.getBizObjectManager("jbo.app.tenwa.doc.LB_DOCLIBRARY");
BizObjectManager attrBm=JBOFactory.getBizObjectManager("jbo.app.tenwa.doc.LB_DOCATTRIBUTE");
BizObject lib=libBm.createQuery("id=:id").setParameter("id", libraryId).getSingleResult(true);
// lib.setAttributeValue("Remark", Remark);
// libBm.saveObject(lib);
BizObject attr=attrBm.newObject();
attr.setAttributeValue("Library_Id", libraryId);
attr.setAttributeValue("FileName", sFileName);
attr.setAttributeValue("InputUserId", CurUser.getUserID());
attr.setAttributeValue("InputOrgId", CurUser.getOrgID());
attr.setAttributeValue("InputTime",InputTime);
attr.setAttributeValue("objectType", objectType);
//得到不带路径的文件名
sFileName = StringFunction.getFileName(sFileName);
sFileName = URLDecoder.decode(URLDecoder.decode(sFileName,"UTF-8"),"UTF-8");
//定义数据库操作变量
SqlObject so = null;
String sNewSql = "";
String sFileSaveMode = CurConfig.getConfigure("FileSaveMode");
String sFileSavePath = CurConfig.getConfigure("FileSavePath");
String sFileNameType = CurConfig.getConfigure("FileNameType");
String trueTable = ((BizObjectTableMapper)attrBm).getTable(); //取得真实的表名
String sAttachmentNo = DBKeyHelp.getSerialNo(trueTable,"Id");
if (!myAmarsoftUpload.getFiles().getFile(0).isMissing()){
try {
//System.out.println("sDocNo="+libraryId+"--sAttachmentNo="+sAttachmentNo+"--sFileName="+sFileName+"--sFileSavePath="+sFileSavePath);
//System.out.println("sFileNameType="+sFileNameType+"--application="+application);
//String sFullPath = com.amarsoft.awe.common.attachment.FileNameHelper.getFullPath(libraryId, sAttachmentNo,sFileName, sFileSavePath, sFileNameType, application);
String uuid=java.util.UUID.randomUUID().toString().replaceAll("-", "");
String sFullPath =com.tenwa.officetempalte.util.FileOperatorUtil.getuploadFileDir(sFileSavePath) +uuid+"_"+sFileName;
// if(myAmarsoftUpload.getFiles().getFile(0).getSize()!=Integer.parseInt(FileSizejs)){
// throw new Exception("上传文件失败,请联系管理员!");
// }
myAmarsoftUpload.getFiles().getFile(0).saveAs(sFullPath);
//得到带相对路径的文件名
String sFilePath = sFullPath.replace(sFileSavePath, "");
attr.setAttributeValue("FilePath",sFilePath);
attr.setAttributeValue("FullPath",sFullPath);
attr.setAttributeValue("Content_Type",DataConvert.toString(myAmarsoftUpload.getFiles().getFile(0).getContentType()));
attr.setAttributeValue("FileSize",DataConvert.toString(String.valueOf(myAmarsoftUpload.getFiles().getFile(0).getSize())));
attrBm.saveObject(attr);
myAmarsoftUpload = null;
}catch(Exception e){
e.printStackTrace();
out.println("An error occurs : " + e.toString());
attrBm.deleteObject(attr);
myAmarsoftUpload = null;
%>
<script type="text/javascript">
alert("上传失败");//上传文件失败!
parent.AsDialog.ClosePage();
</script>
<%
}
}
%>
<script type="text/javascript">
alert("上传成功");//上传文件成功!
parent.AsDialog.ClosePage("success");
</script>
<%@ include file="/IncludeEnd.jsp"%>

View File

@ -0,0 +1,99 @@
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><%
/*
Author: undefined 2018-06-07
Content: 示例详情页面
History Log:
*/
String sPrevUrl = CurPage.getParameter("PrevUrl");
if(sPrevUrl == null) sPrevUrl = "";
String sTempletNo = "LbDoclibraryInfo";//--模板号--
ASObjectModel doTemp = new ASObjectModel(sTempletNo);
doTemp.setColTips("", "");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request);
dwTemp.Style = "2";//freeform
//dwTemp.ReadOnly = "-2";//只读模式
dwTemp.genHTMLObjectWindow(CurPage.getParameter("SerialNo"));
String sButtons[][] = {
{"true","All","Button","保存","保存所有修改","as_save(0)","","","",""},
{String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""}
};
sButtonPosition = "south";
%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%>
<script type="text/javascript">
$(function() {
$("#FILE2").attr("type","file");
$("#myiframe0").attr("enctype","multipart/form-data");
// var params={};
<%-- params["OBJECTTYPE"]="<%=flowNo%>"; --%>
// params["FILENAMEX"]="";
// params["REMARK2"]="";
// params["FileSize2"]="";
// var sparma="";
// for(var key in params){
// sparma=sparma+"<input type=\"text\" name=\""+key+"\" id=\""+key+"\" value=\""+params[key]+"\">"
// }
// $("#FILE2").append(sparma);
$("#myiframe0").attr("action","<%=sWebRootPath%>/Tenwa/Lease/Flow/FileManager/MortgageFile/FileUpload.jsp?CompClientID=<%=CurComp.getClientID()%>");
$("#myiframe0").attr("method","post");
});
function viewAndEdit_attachment(){
if(confirm("确认取消上传?")){
parent.AsDialog.ClosePage("_CANCEL_");
}
}
function importRecord(){
var o = document.forms["myiframe0"];
var sFileName = o.FILE2.value;
var nameArr = sFileName.split("\\");
setItemValue(0,0,"FileName",encodeURI(nameArr[nameArr.length-1]));
$("#FILENAMEX").val(encodeURI(nameArr[nameArr.length-1]));
o.REMARK2.value= encodeURI(getItemValue(0,0,"REMARK"));
if (typeof(sFileName) == "undefined" || sFileName==""){
alert("请选上传的附件!");
return false;
}
if(/[!@'"#$%&\^*]/.test(nameArr[nameArr.length-1])){
alert("文件名不合法");
return;
}
var flag=CheckStr(nameArr[nameArr.length-1].toLowerCase());
if(flag!="true"){
alert("只能上传后缀名为"+flag+"的文件");
return ;
}
var fileSize;
if(typeof(ActiveXObject) == "function"){ // IE
var fso = new ActiveXObject("Scripting.FileSystemObject");
var f1 = fso.GetFile(sFileName);
fileSize = f1.size;
}else{
fileSize = o.FILE2.files[0].size;
}
if(fileSize > 50*1024*1024){
alert("文件大于50MB不能上传");
return false;
}
$("#FileSize2").val(fileSize);
return o.submit();
}
function CheckStr(filename){
var s="jpg,jpeg,png,bmp,gif,pdf,doc,docx,xls,xlsx";
var flag="false";
var s2=s.split(",");
var filenamelast = filename.lastIndexOf(".");
var fileimage = filename.substr(filenamelast+1).toLowerCase();
for(var i=0;i<s2.length;i++){
if(fileimage==s2[i]){
return "true";
}
}
return s;
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -61,7 +61,6 @@
//ÉÏ´«
function upload(id){
debugger;
var param="Library_id="+id;
var sUrl="/Tenwa/Lease/Flow/FileManager/MortgageFile/LbDoclibraryInfo.jsp";
AsDialog.PopView(sUrl,param,"dialogWidth=480px;dialogHeight=400px;resizable=no;scrollbars=no;status:yes;maximize:no;help:no;",function(message){