|
|
@@ -42,27 +42,34 @@ public class ObsAutoDelete extends BaseClass implements Runnable {
|
|
|
String objectname = objectrow.getString("ownertable");
|
|
|
String uniquecolumnname = objectrow.getString("uniquecolumnname");
|
|
|
|
|
|
- Rows tattachmentrows = dbConnect.runSqlQuery("select t1.siteid,t1.tattachmentid,t1.serialnumber,t1.fdocument,t1.fparentid,t1.ftype from tattachment t1 left join " + objectname + " t2 on t1.ownerid=t2." + uniquecolumnname + " inner join tobsmag t3 on t1.siteid=t3.siteid and t3.fisautoclean=1 where t1.ownertable='" + objectname + "' and t2." + uniquecolumnname + " is null");
|
|
|
- for (Row tattachmentrow : tattachmentrows) {
|
|
|
- String siteid = tattachmentrow.getString("siteid");
|
|
|
- String ftype = tattachmentrow.getString("ftype");
|
|
|
- String tattachmentid = tattachmentrow.getString("tattachmentid");
|
|
|
- String serialnumber = tattachmentrow.getString("serialnumber");
|
|
|
- String fdocument = tattachmentrow.getString("fdocument");
|
|
|
- BucketFile bucketFile = new BucketFile(siteid);
|
|
|
- if ("hls".equalsIgnoreCase(ftype)) {
|
|
|
- bucketFile.deleteFolder(serialnumber);
|
|
|
- } else {
|
|
|
- bucketFile.deleteFile(serialnumber);
|
|
|
- }
|
|
|
- if (!bucketFile.doesObjectExist(serialnumber)) {
|
|
|
- printInfoOut("云存储文件清理", siteid + "-表名:" + objectname + ";附件ID:" + tattachmentid + ";云存储文件名:" + serialnumber + ";文件名:" + fdocument);
|
|
|
- SQLFactory sqlFactory=new SQLFactory(this,"附件信息删除");
|
|
|
- sqlFactory.addParameter("siteid",siteid);
|
|
|
- sqlFactory.addParameter("tattachmentid",tattachmentid);
|
|
|
- dbConnect.runSqlUpdate(sqlFactory.getSQL());
|
|
|
+ Rows tattachmentrows = null;
|
|
|
+ try {
|
|
|
+ tattachmentrows = dbConnect.runSqlQuery("select t1.siteid,t1.tattachmentid,t1.serialnumber,t1.fdocument,t1.fparentid,t1.ftype from tattachment t1 left join " + objectname + " t2 on t1.ownerid=t2." + uniquecolumnname + " inner join tobsmag t3 on t1.siteid=t3.siteid and t3.fisautoclean=1 where t1.ownertable='" + objectname + "' and t2." + uniquecolumnname + " is null");
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ if (tattachmentrows != null) {
|
|
|
+ for (Row tattachmentrow : tattachmentrows) {
|
|
|
+ String siteid = tattachmentrow.getString("siteid");
|
|
|
+ String ftype = tattachmentrow.getString("ftype");
|
|
|
+ String tattachmentid = tattachmentrow.getString("tattachmentid");
|
|
|
+ String serialnumber = tattachmentrow.getString("serialnumber");
|
|
|
+ String fdocument = tattachmentrow.getString("fdocument");
|
|
|
+ BucketFile bucketFile = new BucketFile(siteid);
|
|
|
+ if ("hls".equalsIgnoreCase(ftype)) {
|
|
|
+ bucketFile.deleteFolder(serialnumber);
|
|
|
+ } else {
|
|
|
+ bucketFile.deleteFile(serialnumber);
|
|
|
+ }
|
|
|
+ if (!bucketFile.doesObjectExist(serialnumber)) {
|
|
|
+ printInfoOut("云存储文件清理", siteid + "-表名:" + objectname + ";附件ID:" + tattachmentid + ";云存储文件名:" + serialnumber + ";文件名:" + fdocument);
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "附件信息删除");
|
|
|
+ sqlFactory.addParameter("siteid", siteid);
|
|
|
+ sqlFactory.addParameter("tattachmentid", tattachmentid);
|
|
|
+ dbConnect.runSqlUpdate(sqlFactory.getSQL());
|
|
|
+ }
|
|
|
+ bucketFile.close();
|
|
|
}
|
|
|
- bucketFile.close();
|
|
|
}
|
|
|
}
|
|
|
}
|