FileIdToDocId.jsp
5.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<%--
Created by IntelliJ IDEA.
User: zhaiyaqi
Date: 2020/3/15
Time: 7:34 PM
To change this template use File | Settings | File Templates.
--%>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="org.apache.commons.logging.Log" %>
<%@ page import="org.apache.commons.logging.LogFactory" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.conn.RecordSetDataSource" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="java.io.ByteArrayOutputStream" %>
<%@ page import="java.io.InputStream" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Calendar" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.UUID" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
response.setContentType("application/json;charset=utf-8");
out.clear();
writeLog("【wo will start the interface ...】:");
RecordSet rs = new RecordSet();
String result = "-1";
String userid = "";
String uuid = "";
String date = "";
String fileCode = "";
fileCode = "a1a446f4e897d08c854b8d8d601e2ab92e1502c0272ad5ee51261d1776c437dd8eff0d16a57c823657e79cf17bb3c9bbffbd7e9c5f052e501".substring(1);
weaver.docs.docs.util.DesUtils des = null;
try {
des = new weaver.docs.docs.util.DesUtils();
fileCode = des.decrypt(fileCode);
rs.writeLog("weaver-163->getDownloadfileid+fileCode:"+fileCode);
if(fileCode.contains("_")){
userid = Util.null2s(fileCode.split("_")[0],"null");
uuid = Util.null2s(fileCode.split("_")[1],"");
date = Util.null2s(fileCode.split("_")[2],"");
}
rs.writeLog("weaver-169->getDownloadfileid+userid:"+userid);
rs.writeLog("weaver-169->getDownloadfileid+uuid:"+uuid);
rs.writeLog("weaver-169->getDownloadfileid+date:"+date);
result = getFileidByUUid(uuid)+"";
rs.writeLog("weaver-169->getDownloadfileid+result:"+result);
} catch (Exception e) {
e.printStackTrace();
}
out.print(result.toString());
%>
<%!
//得到fileid
public static int getFileidByUUid(String uuid){
int fileid = -1;
String sql ="select imagefileid from file_download_permission where uuid = ?";
RecordSet rs = new RecordSet();
rs.executeQuery(sql,uuid);
if(rs.next()){
fileid = Util.getIntValue(rs.getString("imagefileid"),-1);
}
return fileid;
}
%>
%>
<%!
private void writeLog(Object o) {
Log var3 = LogFactory.getLog(this.getClass().getName());
if(o instanceof Exception) {
var3.info(this.getClass().getName(), (Exception)o);
} else {
var3.info(o);
}
}
private JSONObject getData(String GDZCKPH) {
JSONObject jo = new JSONObject();
RecordSetDataSource rsds = new RecordSetDataSource("HERP");
String sql;
sql = "select * from uf_gdzcb where id='" + GDZCKPH + "'";
rsds.execute(sql);
String[] fields = rsds.getColumnName();
List<String> list = new ArrayList<String>();
list.add("ID");
list.add("REQUESTID");
list.add("FORMMODEID");
list.add("MODEDATACREATER");
list.add("MODEDATACREATERTYPE");
list.add("MODEDATACREATEDATE");
list.add("MODEDATACREATETIME");
list.add("MODEUUID");
list.add("FLOOR");
list.add("LONGITUDE");
list.add("LATITUDE");
list.add("REGIONUUID");
list.add("REGIONNAME");
list.add("REGIONAREA");
list.add("NEARESTREGIONUUID");
list.add("NEARESTREGIONNAME");
list.add("NEARESTREGIONDISTANCE");
list.add("IMAGELIST");
list.add("STATUS");
while (rsds.next()) {
for (String field : fields) {
if (!list.contains(field.toUpperCase())) {
jo.put(field.toUpperCase(), Util.null2String(rsds.getString(field)));
}
}
}
return jo;
}
private String getGDZCKPH(String id) {
if (id.equals("")) {
return "";
}
RecordSetDataSource rsds = new RecordSetDataSource("HERP");
String sql;
sql = "select GDZCKPH from UF_GDZCB where id=" + id;
rsds.execute(sql);
rsds.next();
return Util.null2String(rsds.getString("GDZCKPH"));
}
private String getLastName(String id) {
RecordSet rs = new RecordSet();
String sql;
sql = "select lastname from hrmresource where id=" + id;
rs.execute(sql);
rs.next();
return Util.null2String(rs.getString(1));
}
private byte[] readInputStream(InputStream inStream) throws Exception {
ByteArrayOutputStream outSteam = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
boolean var3 = false;
int len;
while((len = inStream.read(buffer)) != -1) {
outSteam.write(buffer, 0, len);
}
outSteam.close();
inStream.close();
return outSteam.toByteArray();
}
%>