<%@ 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 contentType="text/html;charset=UTF-8" %>
<%

    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 imagefileid = "";
        String sql = " select imagefileid from docimagefile where docid = "+docid;
        rs.executeQuery(sql);
        if(rs.next()) {
            imagefileid = Util.null2String(rs.getString("imagefileid"));
        }
        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() %>
