Файл: Разработка регламента выполнения процесса «Управление документооборотом».pdf
Добавлен: 29.02.2024
Просмотров: 41
Скачиваний: 0
PreparedStatement ps2=con.prepareStatement("Select distinct status FROM Z_ARCH_REQ_DOC where ID_REQ=?");
ps2.setString(1,id);
ResultSet rs2=ps2.executeQuery();
int s=0;
String status=null;
while(rs2.next()){
status=rs2.getString("status");
s++;
}
rs2.close();
ps2.close();
if(s==1){
switch(status){
case "1": //готов
jo.put("STATUS","Ожидание выдачи");
if(!id_status.equals("3")){
ps2=con.prepareStatement("update Z_ARCH_REQ set ID_STATUS=? where id=?");
ps2.setString(1,"3");
ps2.setString(2,id);
ps2.executeUpdate();
ps2.close();
}
break;
case "2": //Выдан
jo.put("STATUS","Выдано");
if(!id_status.equals("4")){
ps2=con.prepareStatement("update Z_ARCH_REQ set ID_STATUS=? where id=?");
ps2.setString(1,"4");
ps2.setString(2,id);
ps2.executeUpdate();
ps2.close();
}
break;
case "3": // возвращён
jo.put("STATUS","Возвращено");
if(!id_status.equals("5")){
ps2=con.prepareStatement("update Z_ARCH_REQ set ID_STATUS=? where id=?");
ps2.setString(1,"5");
ps2.setString(2,id);
ps2.executeUpdate();
ps2.close();
}
break;
}
}
}
ps.close();
rs.close();
}catch(Exception e){
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
String act = "new";
String e_code = "1";
String task_id = "301";
String func_id = "381";
String e_class = this.getServletName();
String user_ua = "";
String user_ip = "";
String e_text = e.getMessage();
String e_level = "0";
String trace = "";
for (int i = 0; i < sw.toString().length(); i++) {
if (i > 3998) {
break;
}
trace = trace + sw.toString().charAt(i);
}
String e_trace = trace;
try {
http.sendErrorPost("http://bazis:7002/api/errors",
"e_code=" + e_code + "&task_id=" + task_id + "&e_class=" + e_class + "&func_id=" +
func_id + "&user_ua=" + user_ua + "&user_ip=" + user_ip + "&e_text=" +
URLEncoder.encode(e_text, "utf-8") + "&e_level=" + e_level + "&e_trace=" +
URLEncoder.encode(e_trace, "utf-8") + "&act=" + act, request);
} catch (Exception e2) {
e.printStackTrace();
}
}
try{
if(con!=null && !con.isClosed()){
con.close();
}
}catch(Exception e){
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
String act = "new";
String e_code = "1";
String task_id = "301";
String func_id = "381";
String e_class = this.getServletName();
String user_ua = "";
String user_ip = "";
String e_text = e.getMessage();
String e_level = "0";
String trace = "";
for (int i = 0; i < sw.toString().length(); i++) {
if (i > 3998) {
break;
}
trace = trace + sw.toString().charAt(i);
}
String e_trace = trace;
try {
http.sendErrorPost("http://bazis:7002/api/errors",
"e_code=" + e_code + "&task_id=" + task_id + "&e_class=" + e_class + "&func_id=" +
func_id + "&user_ua=" + user_ua + "&user_ip=" + user_ip + "&e_text=" +
URLEncoder.encode(e_text, "utf-8") + "&e_level=" + e_level + "&e_trace=" +
URLEncoder.encode(e_trace, "utf-8") + "&act=" + act, request);
} catch (Exception e2) {
e.printStackTrace();
}
}
return res;
}
}