Sfoglia il codice sorgente

附件信息新增系统附件,系统附件查询时增加缓存时长

沈静伟 4 anni fa
parent
commit
f405329ecb

+ 5 - 1
src/dsb/com/cnd3b/restcontroller/system/system/docManage.java

@@ -630,7 +630,11 @@ public class docManage extends Controller {
         } else {
             rows = queryDocRows(ownertable, ownerid);
         }
-        return getSucReturnObject().setData(rows).saveToDataPool().toString();
+        if ("system".equalsIgnoreCase(ownertable)) {
+            return getSucReturnObject().setData(rows).saveToDataPool(60 * 6).toString();
+        } else {
+            return getSucReturnObject().setData(rows).saveToDataPool().toString();
+        }
     }
 
     private Rows queryDocRows(String ownertable, String ownerid) {

+ 27 - 20
src/dsb/com/cnd3b/service/ObsAutoDelete.java

@@ -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();
             }
         }
     }