79 lines
2.8 KiB
Plaintext
79 lines
2.8 KiB
Plaintext
<%@ page import="weaver.general.Util" %>
|
|
<%@ page import="weaver.conn.RecordSet" %>
|
|
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
|
<%@ page import="com.api.doc.detail.util.DocDownloadCheckUtil" %>
|
|
<%@ page import="weaver.hrm.HrmUserVarify" %>
|
|
<%@ page import="weaver.hrm.User" %>
|
|
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
|
<%@ page import="java.io.File" %>
|
|
<%@ page import="java.nio.charset.StandardCharsets" %>
|
|
<%@ page contentType="text/html;charset=UTF-8" %>
|
|
<%
|
|
|
|
String basePath = File.separator+"opt"+File.separator+"weaver"+File.separator+"ecology" ;
|
|
User user = HrmUserVarify.getUser(request, response);
|
|
if(user==null) {
|
|
response.sendRedirect("/login/Login.jsp");
|
|
return;
|
|
}
|
|
|
|
String docid = request.getParameter("docid");
|
|
RecordSet rs = new RecordSet();
|
|
|
|
String videoUrl = "";
|
|
if(StringUtils.isNotBlank(docid)){
|
|
String doccreatedate = "";
|
|
String sql = " select doccreatedate from docdetail where id = "+docid ;
|
|
rs.executeQuery(sql);
|
|
if(rs.next()){
|
|
doccreatedate = Util.null2String(rs.getString("doccreatedate"));
|
|
}
|
|
String imagefileid = "";
|
|
sql = " select imagefileid from docimagefile where docid = "+docid;
|
|
rs.executeQuery(sql);
|
|
if(rs.next()){
|
|
imagefileid = Util.null2String(rs.getString("imagefileid"));
|
|
}
|
|
String imagefilename = "";
|
|
if(StringUtils.isNotBlank(imagefileid)){
|
|
sql = "select imagefilename from imagefile where imagefileid="+imagefileid ;
|
|
rs.executeQuery(sql);
|
|
if(rs.next()){
|
|
imagefilename = Util.null2String(rs.getString("imagefilename"));
|
|
}
|
|
}
|
|
String filepath = File.separator+"filesystem"+File.separator+"convertvideo"+File.separator+doccreatedate+File.separator+imagefileid;
|
|
File path = new File(basePath+filepath) ;
|
|
if(!path.exists()){
|
|
path.mkdirs();
|
|
}
|
|
|
|
if(StringUtils.isNotBlank(imagefilename)){
|
|
String videoPathUrl = filepath + File.separator+imagefilename ; // new String(imagefilename.getBytes(StandardCharsets.ISO_8859_1));
|
|
File videoPath = new File( basePath + videoPathUrl) ;
|
|
|
|
if(videoPath.exists()){
|
|
videoUrl = videoPathUrl;
|
|
}else{
|
|
|
|
|
|
String imagestr = "";
|
|
if(StringUtils.isNotBlank(imagefileid)){
|
|
imagestr = DocDownloadCheckUtil.checkPermission(imagefileid, user);
|
|
videoUrl = "/weaver/weaver.file.FileDownload?fileid="+imagestr;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
// String url = "/weaver/weaver.file.FileDownload?fileid="+imagstr;
|
|
// out.print(url);
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
jsonObject.put("videoUrl",videoUrl);
|
|
|
|
%>
|
|
|
|
<%=jsonObject.toJSONString() %>
|