You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

172 lines
6.1 KiB
Java

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package com.api.sfj.DA.util;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
/**
* 调用归档的方法,建模表单的按钮触发
*/
@Path("/inter/file")
public class GD_Action {
@GET
@Path("/dofiling")
@Produces(MediaType.TEXT_PLAIN)
public String interfile (@Context HttpServletRequest request, @Context HttpServletResponse response){
BaseBean bb = new BaseBean();
String id =request.getParameter("id");
bb.writeLog("进入方法--归档执行开始"+id);
RecordSet rs = new RecordSet();
// String depidSql="SELECT b.id as depid FROM hrmresource a,hrmdepartment b WHERE a.departmentid = b.id AND a.ID=(select creater FROM workflow_requestbase WHERE REQUESTID=(select lcid from uf_dagd where id="+id+"))";
String depidSql="select ssbm from uf_dagd where id="+id;
String depid ="";
try {
rs.executeQuery(depidSql);
if ( rs.next()){
depid = rs.getString("ssbm");
bb.writeLog("执行部门语句----"+depidSql);
}
}catch (Exception e){
bb.writeLog("执行部门语句失败----"+e);
}
//查询归档记录表
String sql ="select * from uf_dagd where id="+id;
int gdzt =-1;
try {
rs.executeQuery(sql);
if (rs.next()){
gdzt = rs.getInt("gdzt");
bb.writeLog("执行语句----"+sql);
}
}catch (Exception e){
bb.writeLog("执行语句失败----"+e);
e.printStackTrace();
}
bb.writeLog("状态信息"+gdzt);
boolean success = false;
int i = 10;
//判断文件归档状态0为未归档
bb.writeLog("归档状态"+gdzt);
if(gdzt==0){
String filename = rs.getString("wjjmc");
String filepath = rs.getString("wjlj");
String sfwlb = rs.getString("sfwlb");
//执行档案归档文件上传方法
bb.writeLog("文件相关信息"+filename+"--"+filepath+"--"+sfwlb);
DaHttpAction daHttpAction = new DaHttpAction();
try {
bb.writeLog("进入daHttpAction.doit方法");
i= daHttpAction.doit(filename,filepath,sfwlb,depid);
} catch (Exception e) {
e.printStackTrace();
}
bb.writeLog("返回信息str"+i);
//将记录表中的未归档状态修改为归档="
if(i!=0){
bb.writeLog("上传出问题了-----"+i);
}else if(i==0){
String upsql = "update uf_dagd set gdzt =1 where id="+id;
RecordSet rs1 = new RecordSet();
bb.writeLog("sql--->"+upsql);
success = rs1.executeUpdate(upsql);
bb.writeLog("上传成功-----"+success);
}
}
//除0 以外的所有返回信息都是错误
return i+"";
}
@GET
@Path("/dofilings")
@Produces(MediaType.TEXT_PLAIN)
public String interfiles (@Context HttpServletRequest request, @Context HttpServletResponse response) {
BaseBean bb = new BaseBean();
String id = request.getParameter("id");
bb.writeLog("进入方法--归档执行开始" + id);
RecordSet rs = new RecordSet();
String[] arr = id.split(",");
int i = 10;
int flag = 10;
for (int y = 0; y < arr.length; y++) {
boolean success = false;
String depidSql="select ssbm from uf_dagd where id="+arr[y];
String depid ="";
try {
rs.executeQuery(depidSql);
if (rs.next()){
depid = rs.getString("ssbm");
bb.writeLog("执行部门语句----"+depidSql);
}
}catch (Exception e){
bb.writeLog("执行部门语句失败----"+e);
}
//查询归档记录表
String sql = "select * from uf_dagd where id=" + arr[y];
int gdzt = -1;
try {
rs.executeQuery(sql);
if (rs.next()){
gdzt = rs.getInt("gdzt");
bb.writeLog("执行语句----" + sql);
}
} catch (Exception e) {
bb.writeLog("执行语句失败----" + e);
e.printStackTrace();
}
bb.writeLog("状态信息" + gdzt);
//判断文件归档状态0为未归档
bb.writeLog("归档状态" + gdzt);
if (gdzt == 0) {
String filename = rs.getString("wjjmc");
String filepath = rs.getString("wjlj");
String sfwlb = rs.getString("sfwlb");
//执行档案归档文件上传方法
bb.writeLog("文件相关信息" + filename + "--" + filepath + "--" + sfwlb);
DaHttpAction daHttpAction = new DaHttpAction();
try {
bb.writeLog("进入daHttpAction.doit方法");
i = daHttpAction.doit(filename,filepath,sfwlb,depid);
} catch (Exception e) {
e.printStackTrace();
}
bb.writeLog("返回信息str" + i);
//将记录表中的未归档状态修改为归档="
if (i != 0) {
bb.writeLog("归档出问题了----->" + i);
} else if (i == 0) {
flag = 0;
String upsql = "update uf_dagd set gdzt =1 where id=" + arr[y];
RecordSet rs1 = new RecordSet();
bb.writeLog("sql--->" + upsql);
success = rs1.executeUpdate(upsql);
bb.writeLog("上传成功更新数据库----->"+success);
}
}
}
//除0 以外的所有返回信息都是错误
return flag + "";
}
}