wuxw лет назад: 3
Родитель
Сommit
d7d5f2d072

+ 1 - 1
java110-db/src/main/resources/mapper/job/UserDownloadFileV1ServiceDaoImplMapper.xml

@@ -20,7 +20,7 @@
         select t.name,t.download_id,t.download_id downloadId,t.download_user_id,t.download_user_id
         downloadUserId,t.status_cd,t.status_cd statusCd,t.state,t.temp_url,t.temp_url
         tempUrl,t.community_id,t.community_id communityId,t.download_user_name,t.download_user_name
-        downloadUserName,t.file_type,t.file_type fileType,td.name stateName,td1.name fileTypeName,t.create_time
+        downloadUserName,t.file_type,t.file_type fileType,td.name stateName,td1.name fileTypeName,t.create_time createTime
         from user_download_file t
         left join t_dict td on t.state = td.status_cd and td.table_name = 'user_download_file' and td.table_columns = 'state'
         left join t_dict td1 on t.file_type = td1.status_cd and td1.table_name = 'user_download_file' and td1.table_columns = 'file_type'

+ 18 - 7
service-job/src/main/java/com/java110/job/export/ExportDataExecutor.java

@@ -30,19 +30,30 @@ public class ExportDataExecutor implements Runnable {
     //默认线程大小
     private static final int DEFAULT_EXPORT_POOL = 4;
 
-    public ExportDataExecutor() {
+    private boolean isRun = false;
+
+    public ExportDataExecutor(boolean isRun) {
         this.userDownloadFileV1InnerServiceSMOImpl = ApplicationContextFactory.getBean("userDownloadFileV1InnerServiceSMOImpl", IUserDownloadFileV1InnerServiceSMO.class);
         this.fileUploadTemplate = ApplicationContextFactory.getBean("fileUploadTemplate", FileUploadTemplate.class);
+        this.isRun = isRun;
+    }
+
+    public ExportDataExecutor() {
     }
 
     @Override
     public void run() {
 
-        try {
-            doExportData();
-        } catch (Exception e) {
-            log.error("处理消息异常", e);
-            e.printStackTrace();
+        while (isRun) {
+            log.debug("导出数据线程开始处理");
+            try {
+                doExportData();
+            } catch (Exception e) {
+                log.error("处理消息异常", e);
+                e.printStackTrace();
+            }
+            log.debug("导出数据线程开始完成");
+
         }
 
     }
@@ -116,6 +127,6 @@ public class ExportDataExecutor implements Runnable {
      */
     public static void startExportDataExecutor() {
         ExecutorService executorService = Executors.newFixedThreadPool(DEFAULT_EXPORT_POOL);
-        executorService.execute(new ExportDataExecutor());
+        executorService.execute(new ExportDataExecutor(true));
     }
 }