Kaynağa Gözat

疏浚封装定时任务封装统一返回结果

zoro 10 ay önce
ebeveyn
işleme
05f4947830

+ 3 - 2
src/main/java/tech/powerjob/work/scheduleWork/DredgingSchedule.java

@@ -6,6 +6,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
 import tech.powerjob.work.entity.DredgingImportRule;
 import tech.powerjob.work.service.DredgingService;
+import tech.powerjob.work.util.ReturnMsg;
 import tech.powerjob.worker.core.processor.ProcessResult;
 import tech.powerjob.worker.core.processor.TaskContext;
 import tech.powerjob.worker.core.processor.sdk.BasicProcessor;
@@ -27,10 +28,10 @@ public class DredgingSchedule implements BasicProcessor {
         } catch (Exception e) {
           e.printStackTrace();
           log.error("{}疏浚数据导入失败", e.getMessage());
-          return new ProcessResult(false);
+          return ReturnMsg.returnMsg(false);
         }
       }
     }
-    return new ProcessResult(true);
+    return ReturnMsg.returnMsg(true);
   }
 }

+ 14 - 0
src/main/java/tech/powerjob/work/util/ReturnMsg.java

@@ -0,0 +1,14 @@
+package tech.powerjob.work.util;
+
+import tech.powerjob.worker.core.processor.ProcessResult;
+
+public class ReturnMsg extends ProcessResult {
+
+    public static ProcessResult returnMsg(Boolean isSuccess, String msg) {
+        return new ProcessResult(isSuccess, msg);
+    }
+
+    public static ProcessResult returnMsg(Boolean isSuccess) {
+        return new ProcessResult(isSuccess);
+    }
+}

+ 2 - 2
src/main/resources/application.properties

@@ -19,9 +19,9 @@ powerjob.worker.protocol=http
 powerjob.worker.max-result-length=4096
 # Max length of appended workflow context . Appended workflow context value that is longer than the value will be ignore.
 powerjob.worker.max-appended-wf-context-length=4096
-spring.datasource.url=jdbc:kingbase8://10.83.240.181:54322/kingbase
+spring.datasource.url=jdbc:kingbase8://174.0.123.203:54323/kingbase
 spring.datasource.username=system
-spring.datasource.password=Ghzx2023!
+spring.datasource.password=12345678ab
 spring.datasource.driver-class-name=com.kingbase8.Driver
 spring.datasource.hikari.maximum-pool-size=60
 spring.datasource.hikari.maximum-idle=15