%@page import="java.util.Date"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="org.springframework.http.HttpStatus"%>
<%@page import="com.uas.cr.util.HttpUtil.Response"%>
<%@page import="com.uas.cr.util.FlexJsonUtil"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.util.Map"%>
<%@page import="com.uas.cr.util.HttpUtil"%>
<%@ page import="com.jspsmart.upload.File"%>
<%@ page import="com.jspsmart.upload.SmartUpload"%>
<%@ page import="java.util.List"%>
<%@ page import="java.sql.PreparedStatement"%>
<%@ page import="java.sql.Connection"%>
<%@ page import="com.uas.cr.util.DBConnection"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="com.uas.cr.util.FileUtil"%>
<%@ page import="java.net.URLEncoder"%>
<%@ page import="java.io.*"%>
上传
<%try {
SmartUpload su = new SmartUpload();
su.initialize(pageContext);
su.service(request, response);
su.setTotalMaxFileSize(100000000);
su.upload();
String uu = su.getRequest().getParameter("uu");
String reportBusi = su.getRequest().getParameter("reportBusi");
String description = su.getRequest().getParameter("description");
String reportPageName = su.getRequest().getParameter("reportPageName");
String name = su.getRequest().getParameter("userName");
File suFile = su.getFiles().getFile(0);
String fileName = suFile.getFilePathName();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd H-m-s");
String date = sdf.format(new Date());
if (!suFile.isMissing()) {
String realPath = application.getRealPath(request.getRequestURI());
java.io.File transFile = new java.io.File(realPath);
realPath = transFile.getParentFile().getParentFile().getParentFile().getPath() + "/rpt";
String backupPath = transFile.getParentFile().getParentFile().getParentFile().getParentFile().getParentFile().getPath() + "/rpt";
java.io.File fileTemp = new java.io.File(realPath);
java.io.File backupfileTemp = new java.io.File(backupPath);
if (!fileTemp.exists()) {
fileTemp.mkdir();
}
if (!backupfileTemp.exists()) {
backupfileTemp.mkdir();
}
realPath = realPath + "/" + uu;
backupPath = backupfileTemp + "/" + uu;
fileTemp = new java.io.File(realPath);
backupfileTemp = new java.io.File(backupPath);
if (!fileTemp.exists()) {
fileTemp.mkdir();
}
if (!backupfileTemp.exists()) {
backupfileTemp.mkdir();
}
realPath = realPath + "/";
backupPath = backupPath + "/";
backupPath = backupPath +date+ suFile.getFilePathName();
realPath = realPath + suFile.getFilePathName();
fileTemp = new java.io.File(realPath);
DBConnection db = new DBConnection();
Connection con = db.createCon();
PreparedStatement pre = null;
if(fileTemp.exists()) {
pre = con.prepareStatement("update REPORT$CONFIG set RE_PAGENAME= ? where RE_ENUU= ? and RE_REPORTNAME= ?");
pre.setString(1, reportPageName);
pre.setLong(2, Long.parseLong(uu));
pre.setString(3, suFile.getFilePathName());
}else {
pre = con.prepareStatement(
"insert into REPORT$CONFIG(RE_ID, RE_ENUU, RE_REPORTNAME, RE_PAGENAME) values (REPORT$CONFIG_seq.nextval, ?, ?, ?)");
pre.setLong(1, Long.parseLong(uu));
pre.setString(2, suFile.getFilePathName());
pre.setString(3, reportPageName);
}
suFile.saveAs(realPath);
suFile.saveAs(backupPath);
pre.executeUpdate();
Map map = new HashMap();
List