2018-06-03 22:26:41 +08:00

50 lines
2.0 KiB
Plaintext

<%@page import="com.tenwa.reckon.executor.CreateTransactionExecutor"%>
<%@page import="com.tenwa.file.TemplateManage.*"%>
<%@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 import="com.amarsoft.awe.common.attachment.*"%>
<%@page import="com.amarsoft.are.util.json.*"%>
<%@page import="com.tenwa.officetempalte.util.FileOperatorUtil"%>
<%@page import="java.io.*" %>
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/IncludeBegin.jsp"%>
<%
ServletContext s1=this.getServletContext();
String rootPath=s1.getRealPath("/");
AmarsoftUpload myAmarsoftUpload = new AmarsoftUpload();
myAmarsoftUpload.initialize(pageContext);
myAmarsoftUpload.upload();
int cindex=0;
String cmessage="";
if (!myAmarsoftUpload.getFiles().getFile(0).isMissing()){
try {
JBOTransaction tx=JBOFactory.getFactory().createTransaction();
String importparam= CurPage.getParameter("importparam");
importparam=importparam.replaceAll("@", ",");
JSONObject paramJson=JSONDecoder.decode(importparam);
Map<String,String>sourceMap=FileOperatorUtil.getJsonObjectToMap(paramJson);
System.out.println(sourceMap.toString());
CreateTransactionExecutor transaction = new CreateTransactionExecutor();
cindex=transaction.importRentPlan( myAmarsoftUpload.getFiles().getFile(0).getFileName(), myAmarsoftUpload.getFiles().getFile(0).toInputStream(), sourceMap);
myAmarsoftUpload = null;
}catch(Exception e){
e.printStackTrace();
myAmarsoftUpload = null;
cmessage=e.getMessage();
%>
<script type="text/javascript">
alert("上传失败<%=cmessage%>");//上传文件失败!
window.close();
parent.AsDialog.ClosePage();
</script>
<%
}
}
%>
<script type="text/javascript">
alert("成功上传<%=cindex%>条");//上传文件成功!
parent.AsDialog.ClosePage("true");
</script>
<%@ include file="/IncludeEnd.jsp"%>