|
|
@@ -265,7 +265,6 @@ public class docManage extends Controller {
|
|
|
String ownerid = obsfilemap.get(obsfilename).get("ownerid");
|
|
|
String ftype = obsfilemap.get(obsfilename).get("ftype");
|
|
|
|
|
|
-
|
|
|
JSONObject resultObject = new JSONObject();
|
|
|
try {
|
|
|
|
|
|
@@ -273,22 +272,8 @@ public class docManage extends Controller {
|
|
|
if (!bucketFile.doesObjectExist(obsfilename)) {
|
|
|
return getErrReturnObject().setErrMsg("找不到对应的云存储文件").toString();
|
|
|
}
|
|
|
- /**
|
|
|
- * 获取原文件的访问地址
|
|
|
- */
|
|
|
- String obsurl = bucketFile.getFileUrl(obsfilename);
|
|
|
- ObjectMetadata matedata = bucketFile.getObjectMetadata(obsfilename);
|
|
|
- long contentlength = matedata.getContentLength();
|
|
|
- /**
|
|
|
- * 获取缩略图的访问地址
|
|
|
- */
|
|
|
- String obsurl_imageshort = "";
|
|
|
- String obsurl_imagecompress = "";
|
|
|
- if (isImage(filetype)) {
|
|
|
- obsurl_imageshort = bucketFile.getMinImageUrl(obsfilename);
|
|
|
- obsurl_imagecompress = bucketFile.getCompressImageUrl(obsfilename);
|
|
|
- }
|
|
|
- bucketFile.close();
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 视频转码
|
|
|
*/
|
|
|
@@ -305,35 +290,81 @@ public class docManage extends Controller {
|
|
|
MpcFactory mpcFactory = new MpcFactory();
|
|
|
mpctaskid = mpcFactory.createMpcTask(siteid, obsfilename);
|
|
|
}
|
|
|
+ ArrayList<String> SQlist = new ArrayList<>();
|
|
|
/**
|
|
|
* 本地信息插入
|
|
|
*/
|
|
|
- SQLFactory sqlFactory = new SQLFactory(this, "附件信息插入");
|
|
|
- sqlFactory.addParameter("tattachmentid", createTableID("tattachment", "tattachmentid"));
|
|
|
- sqlFactory.addParameter("siteid", siteid);
|
|
|
- sqlFactory.addParameter("ownertable", ownertable);
|
|
|
- sqlFactory.addParameter("ownerid", ownerid);
|
|
|
- sqlFactory.addParameter("createby", username);
|
|
|
- sqlFactory.addParameter("ftype", ftype);
|
|
|
- sqlFactory.addParameter("postfix", filetype);
|
|
|
- sqlFactory.addParameter("serialnumber", obsfilename);
|
|
|
- filename = filename.replace("'", "");
|
|
|
- sqlFactory.addParameter("fdocument", filename);
|
|
|
- sqlFactory.addParameter("fobsurl", obsurl);
|
|
|
- sqlFactory.addParameter("fobsurl_minimage", obsurl_imageshort);
|
|
|
- sqlFactory.addParameter("fobsurl_compressimage", obsurl_imagecompress);
|
|
|
- sqlFactory.addParameter("mpctaskid", mpctaskid);
|
|
|
- sqlFactory.addParameter("contentlength", contentlength);
|
|
|
-
|
|
|
- dbConnect.runSqlUpdate(sqlFactory.getSQL());
|
|
|
+ long tattachmentid = createTableID("tattachment", "tattachmentid");
|
|
|
+ {
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "附件信息插入");
|
|
|
+ sqlFactory.addParameter("tattachmentid", tattachmentid);
|
|
|
+ sqlFactory.addParameter("siteid", siteid);
|
|
|
+ sqlFactory.addParameter("ownertable", ownertable);
|
|
|
+ sqlFactory.addParameter("ownerid", ownerid);
|
|
|
+ sqlFactory.addParameter("createby", username);
|
|
|
+ sqlFactory.addParameter("ftype", ftype);
|
|
|
+ sqlFactory.addParameter("postfix", filetype);
|
|
|
+ sqlFactory.addParameter("serialnumber", obsfilename);
|
|
|
+ filename = filename.replace("'", "");
|
|
|
+ sqlFactory.addParameter("fdocument", filename);
|
|
|
+ sqlFactory.addParameter("fobsurl", bucketFile.getFileUrl(obsfilename));
|
|
|
+ sqlFactory.addParameter("mpctaskid", mpctaskid);
|
|
|
+ sqlFactory.addParameter("contentlength", bucketFile.getObjectMetadata(obsfilename).getContentLength());
|
|
|
+
|
|
|
+ SQlist.add(sqlFactory.getSQL());
|
|
|
+ }
|
|
|
+ if (isImage(filetype)) {
|
|
|
+ {
|
|
|
+ //生成缩略图附件信息
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "子附件信息插入");
|
|
|
+ sqlFactory.addParameter("fparentid", tattachmentid);
|
|
|
+ sqlFactory.addParameter("tattachmentid", createTableID("tattachment", "tattachmentid"));
|
|
|
+ sqlFactory.addParameter("siteid", siteid);
|
|
|
+ sqlFactory.addParameter("ownertable", ownertable);
|
|
|
+ sqlFactory.addParameter("ownerid", ownerid);
|
|
|
+ sqlFactory.addParameter("createby", username);
|
|
|
+ sqlFactory.addParameter("ftype", "thumbnail");
|
|
|
+ sqlFactory.addParameter("postfix", filetype);
|
|
|
+ sqlFactory.addParameter("serialnumber", "s_" + obsfilename);
|
|
|
+ filename = filename.replace("'", "");
|
|
|
+ sqlFactory.addParameter("fdocument", filename);
|
|
|
+ sqlFactory.addParameter("fobsurl", bucketFile.getMinImageUrl(obsfilename));
|
|
|
+ sqlFactory.addParameter("contentlength", bucketFile.getObjectMetadata("s_" + obsfilename).getContentLength());
|
|
|
+ SQlist.add(sqlFactory.getSQL());
|
|
|
+ }
|
|
|
+ {
|
|
|
+ /**
|
|
|
+ * 生成压缩图附件信息
|
|
|
+ */
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "子附件信息插入");
|
|
|
+ sqlFactory.addParameter("fparentid", tattachmentid);
|
|
|
+ sqlFactory.addParameter("tattachmentid", createTableID("tattachment", "tattachmentid"));
|
|
|
+ sqlFactory.addParameter("siteid", siteid);
|
|
|
+ sqlFactory.addParameter("ownertable", ownertable);
|
|
|
+ sqlFactory.addParameter("ownerid", ownerid);
|
|
|
+ sqlFactory.addParameter("createby", username);
|
|
|
+ sqlFactory.addParameter("ftype", "compressed");
|
|
|
+ sqlFactory.addParameter("postfix", filetype);
|
|
|
+ sqlFactory.addParameter("serialnumber", "c_" + obsfilename);
|
|
|
+ filename = filename.replace("'", "");
|
|
|
+ sqlFactory.addParameter("fdocument", filename);
|
|
|
+ sqlFactory.addParameter("fobsurl", bucketFile.getCompressImageUrl(obsfilename));
|
|
|
+ sqlFactory.addParameter("contentlength", bucketFile.getObjectMetadata("c_" + obsfilename).getContentLength());
|
|
|
+ SQlist.add(sqlFactory.getSQL());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ dbConnect.runSqlUpdate(SQlist);
|
|
|
obsfilemap.remove(obsfilename);
|
|
|
resultObject.put("code", 1);
|
|
|
resultObject.put("msg", "成功");
|
|
|
+
|
|
|
if (content.getBooleanValue("fisreturnallfile")) {
|
|
|
- resultObject.put("data", queryDocRow(ownertable, ownerid, obsfilename));
|
|
|
- } else {
|
|
|
resultObject.put("data", queryDocRows(ownertable, ownerid));
|
|
|
+ } else {
|
|
|
+ resultObject.put("data", queryDocRow(obsfilename));
|
|
|
}
|
|
|
+ bucketFile.close();
|
|
|
} catch (Exception exception) {
|
|
|
resultObject.put("code", 0);
|
|
|
resultObject.put("msg", exception.getMessage());
|
|
|
@@ -368,23 +399,7 @@ public class docManage extends Controller {
|
|
|
if (!bucketFile.doesObjectExist(obsfilename)) {
|
|
|
continue;
|
|
|
}
|
|
|
- /**
|
|
|
- * 获取原文件的访问地址
|
|
|
- */
|
|
|
- String obsurl = bucketFile.getFileUrl(obsfilename);
|
|
|
- ObjectMetadata matedata = bucketFile.getObjectMetadata(obsfilename);
|
|
|
- long contentlength = matedata.getContentLength();
|
|
|
- String contenttype = matedata.getContentType();
|
|
|
- /**
|
|
|
- * 获取缩略图的访问地址
|
|
|
- */
|
|
|
- String obsurl_imageshort = "";
|
|
|
- String obsurl_imagecompress = "";
|
|
|
- if (isImage(filetype)) {
|
|
|
- obsurl_imageshort = bucketFile.getMinImageUrl(obsfilename);
|
|
|
- obsurl_imagecompress = bucketFile.getCompressImageUrl(obsfilename);
|
|
|
- }
|
|
|
- bucketFile.close();
|
|
|
+
|
|
|
/**
|
|
|
* 视频转码
|
|
|
*/
|
|
|
@@ -404,25 +419,67 @@ public class docManage extends Controller {
|
|
|
/**
|
|
|
* 本地信息插入
|
|
|
*/
|
|
|
- SQLFactory sqlFactory = new SQLFactory(this, "附件信息插入");
|
|
|
- sqlFactory.addParameter("tattachmentid", createTableID("tattachment", "tattachmentid"));
|
|
|
- sqlFactory.addParameter("siteid", siteid);
|
|
|
- sqlFactory.addParameter("ownertable", ownertable);
|
|
|
- sqlFactory.addParameter("ownerid", ownerid);
|
|
|
- sqlFactory.addParameter("createby", username);
|
|
|
- sqlFactory.addParameter("ftype", ftype);
|
|
|
- sqlFactory.addParameter("postfix", filetype);
|
|
|
- sqlFactory.addParameter("serialnumber", obsfilename);
|
|
|
- filename = filename.replace("'", "");
|
|
|
- sqlFactory.addParameter("fdocument", filename);
|
|
|
- sqlFactory.addParameter("fobsurl", obsurl);
|
|
|
- sqlFactory.addParameter("fobsurl_minimage", obsurl_imageshort);
|
|
|
- sqlFactory.addParameter("fobsurl_compressimage", obsurl_imagecompress);
|
|
|
- sqlFactory.addParameter("mpctaskid", mpctaskid);
|
|
|
- sqlFactory.addParameter("contentlength", contentlength);
|
|
|
+ long tattachmentid = createTableID("tattachment", "tattachmentid");
|
|
|
+ {
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "附件信息插入");
|
|
|
+ sqlFactory.addParameter("tattachmentid", tattachmentid);
|
|
|
+ sqlFactory.addParameter("siteid", siteid);
|
|
|
+ sqlFactory.addParameter("ownertable", ownertable);
|
|
|
+ sqlFactory.addParameter("ownerid", ownerid);
|
|
|
+ sqlFactory.addParameter("createby", username);
|
|
|
+ sqlFactory.addParameter("ftype", ftype);
|
|
|
+ sqlFactory.addParameter("postfix", filetype);
|
|
|
+ sqlFactory.addParameter("serialnumber", obsfilename);
|
|
|
+ filename = filename.replace("'", "");
|
|
|
+ sqlFactory.addParameter("fdocument", filename);
|
|
|
+ sqlFactory.addParameter("fobsurl", bucketFile.getFileUrl(obsfilename));
|
|
|
+ sqlFactory.addParameter("mpctaskid", mpctaskid);
|
|
|
+ sqlFactory.addParameter("contentlength", bucketFile.getObjectMetadata(obsfilename).getContentLength());
|
|
|
+ SQLlist.add(sqlFactory.getSQL());
|
|
|
+ }
|
|
|
+ if (isImage(filetype)) {
|
|
|
+ {
|
|
|
+ //生成缩略图附件信息
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "子附件信息插入");
|
|
|
+ sqlFactory.addParameter("fparentid", tattachmentid);
|
|
|
+ sqlFactory.addParameter("tattachmentid", createTableID("tattachment", "tattachmentid"));
|
|
|
+ sqlFactory.addParameter("siteid", siteid);
|
|
|
+ sqlFactory.addParameter("ownertable", ownertable);
|
|
|
+ sqlFactory.addParameter("ownerid", ownerid);
|
|
|
+ sqlFactory.addParameter("createby", username);
|
|
|
+ sqlFactory.addParameter("ftype", "thumbnail");
|
|
|
+ sqlFactory.addParameter("postfix", filetype);
|
|
|
+ sqlFactory.addParameter("serialnumber", "s_" + obsfilename);
|
|
|
+ filename = filename.replace("'", "");
|
|
|
+ sqlFactory.addParameter("fdocument", filename);
|
|
|
+ sqlFactory.addParameter("fobsurl", bucketFile.getMinImageUrl(obsfilename));
|
|
|
+ sqlFactory.addParameter("contentlength", bucketFile.getObjectMetadata("s_" + obsfilename).getContentLength());
|
|
|
+ SQLlist.add(sqlFactory.getSQL());
|
|
|
+ }
|
|
|
+ {
|
|
|
+ /**
|
|
|
+ * 生成压缩图附件信息
|
|
|
+ */
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "子附件信息插入");
|
|
|
+ sqlFactory.addParameter("fparentid", tattachmentid);
|
|
|
+ sqlFactory.addParameter("tattachmentid", createTableID("tattachment", "tattachmentid"));
|
|
|
+ sqlFactory.addParameter("siteid", siteid);
|
|
|
+ sqlFactory.addParameter("ownertable", ownertable);
|
|
|
+ sqlFactory.addParameter("ownerid", ownerid);
|
|
|
+ sqlFactory.addParameter("createby", username);
|
|
|
+ sqlFactory.addParameter("ftype", "compressed");
|
|
|
+ sqlFactory.addParameter("postfix", filetype);
|
|
|
+ sqlFactory.addParameter("serialnumber", "c_" + obsfilename);
|
|
|
+ filename = filename.replace("'", "");
|
|
|
+ sqlFactory.addParameter("fdocument", filename);
|
|
|
+ sqlFactory.addParameter("fobsurl", bucketFile.getCompressImageUrl(obsfilename));
|
|
|
+ sqlFactory.addParameter("contentlength", bucketFile.getObjectMetadata("c_" + obsfilename).getContentLength());
|
|
|
+ SQLlist.add(sqlFactory.getSQL());
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- SQLlist.add(sqlFactory.getSQL());
|
|
|
obsfilemap.remove(obsfilename);
|
|
|
+ bucketFile.close();
|
|
|
} catch (Exception exception) {
|
|
|
exception.printStackTrace();
|
|
|
}
|
|
|
@@ -545,32 +602,15 @@ public class docManage extends Controller {
|
|
|
}
|
|
|
|
|
|
private Rows queryDocRows(String ownertable, String ownerid) {
|
|
|
- DBConnect dbConnect = new DBConnect();
|
|
|
- SQLFactory sqlFactory = new SQLFactory(this, "附件查询");
|
|
|
- sqlFactory.addParameter("siteid", siteid);
|
|
|
- sqlFactory.addParameter("ownertable", ownertable);
|
|
|
- sqlFactory.addParameter("ownerid", ownerid);
|
|
|
- return dbConnect.runSqlQuery(sqlFactory.getSQL());
|
|
|
+ return getAttachmentUrl(ownertable, ownerid);
|
|
|
}
|
|
|
|
|
|
private Rows queryDocRows(String ownertable, String ownerid, String ftype) {
|
|
|
- DBConnect dbConnect = new DBConnect();
|
|
|
- SQLFactory sqlFactory = new SQLFactory(this, "附件查询_按类别");
|
|
|
- sqlFactory.addParameter("siteid", siteid);
|
|
|
- sqlFactory.addParameter("ftype", ftype);
|
|
|
- sqlFactory.addParameter("ownertable", ownertable);
|
|
|
- sqlFactory.addParameter("ownerid", ownerid);
|
|
|
- return dbConnect.runSqlQuery(sqlFactory.getSQL());
|
|
|
+ return getAttachmentUrl(ownertable, ownerid, ftype);
|
|
|
}
|
|
|
|
|
|
- private Rows queryDocRow(String ownertable, String ownerid, String obsfilename) {
|
|
|
- DBConnect dbConnect = new DBConnect();
|
|
|
- SQLFactory sqlFactory = new SQLFactory(this, "单附件查询");
|
|
|
- sqlFactory.addParameter("siteid", siteid);
|
|
|
- sqlFactory.addParameter("ownertable", ownertable);
|
|
|
- sqlFactory.addParameter("ownerid", ownerid);
|
|
|
- sqlFactory.addParameter("serialnumber", obsfilename);
|
|
|
- return dbConnect.runSqlQuery(sqlFactory.getSQL());
|
|
|
+ private Rows queryDocRow(String obsfilename) {
|
|
|
+ return getAttachmentUrl(obsfilename);
|
|
|
}
|
|
|
|
|
|
|