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

95 lines
3.9 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@page import="com.tenwa.reckon.util.UUIDUtil"%>
<%@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();
// 用户ID
String USER_ID = (String)myAmarsoftUpload.getRequest().getParameter("usreid");
// 版本号
String VERSION_CODE = CurPage.getParameter("VERSION_CODE");
// 版本名
String VERSION_NAME = CurPage.getParameter("VERSION_NAME");
// 版本描述
String VERSION_DESC = CurPage.getParameter("VERSION_DESC");
// 发布时间
String UP_DATE = (String)myAmarsoftUpload.getRequest().getParameter("UP_DATE");
// 是否新版本
String IS_NEW = CurPage.getParameter("IS_NEW");
// 手机类型
String PHONE_TYPE = CurPage.getParameter("PHONE_TYPE");
// 是否强制更新
String MUST_UPDATE = CurPage.getParameter("MUST_UPDATE");
// 上传本地文件名称
String sFileName = (String)myAmarsoftUpload.getRequest().getParameter("FILENAME");
// 得到不带路径的文件名
sFileName = StringFunction.getFileName(sFileName);
sFileName = URLDecoder.decode(URLDecoder.decode(sFileName,"UTF-8"),"UTF-8");
VERSION_DESC = StringFunction.getFileName(VERSION_DESC);
VERSION_DESC = URLDecoder.decode(VERSION_DESC,"UTF-8");
VERSION_NAME = StringFunction.getFileName(VERSION_NAME);
VERSION_NAME = URLDecoder.decode(VERSION_NAME,"UTF-8");
// 当前时间
java.util.Date dateNow = new java.util.Date();
SimpleDateFormat sdfTemp = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss");
String date = sdfTemp.format(dateNow);
String date1 = date;
date1 = date1.replace(" ", "");
date1 = date1.replace(":", "");
date1 = date1.replace("/", "");
// 服务器保存文件名称 年月日_本地文件名
String RandomName = date1 + "_" + sFileName;
String sFileSaveMode = CurConfig.getConfigure("FileSaveMode");
String sFileSavePath = CurConfig.getConfigure("FileSavePath");
String sFileNameType = CurConfig.getConfigure("FileNameType");
String sFullPath = "";
if (!myAmarsoftUpload.getFiles().getFile(0).isMissing()){
try {
if(sFileSaveMode.equals("Disk")) {
// 获取全路径
sFullPath = sFileSavePath+"/"+RandomName;
// 保存服务器文件
myAmarsoftUpload.getFiles().getFile(0).saveAs(sFullPath);
// 保存APP_VERSION
BizObjectManager bm = JBOFactory.getBizObjectManager("jbo.app.APP_VERSION");
BizObject bo = bm.newObject();
String id = UUIDUtil.getUUID();
bo.setAttributeValue("id", id);
bo.setAttributeValue("VERSION_CODE", VERSION_CODE);
bo.setAttributeValue("VERSION_NAME", VERSION_NAME);
bo.setAttributeValue("VERSION_DESC", VERSION_DESC);
bo.setAttributeValue("UP_DATE", UP_DATE);
bo.setAttributeValue("FILE_NAME", sFileName);
bo.setAttributeValue("IMAGE_PATH", sFullPath);
bo.setAttributeValue("IS_NEW", IS_NEW);
bo.setAttributeValue("MUST_UPDATE", MUST_UPDATE);
bo.setAttributeValue("PHONE_TYPE", PHONE_TYPE);
bo.setAttributeValue("CREATOR", USER_ID);
bo.setAttributeValue("MODIFICATOR", USER_ID);
bo.setAttributeValue("CREATE_DATE", date);
bo.setAttributeValue("MODIFY_DATE", date);
bo.setAttributeValue("BASE_FILE_ID", "");
bm.saveObject(bo);
}
} catch(Exception e){
out.println("An error occurs : " + e.toString());
myAmarsoftUpload = null;
%>
<script type="text/javascript">
alert(getMessageText('AWEW1010'));//上传文件失败!
parent.AsDialog.ClosePage();
</script>
<%
}
}
%>
<script type="text/javascript">
alert(getMessageText('AWEW1013'));//上传文件成功!
parent.AsDialog.ClosePage();
//parent.reloadAttachment();
</script>
<%@ include file="/IncludeEnd.jsp"%>