zhouhao 6 лет назад
Родитель
Сommit
7bc7090e29

+ 5 - 1
hsweb-system/hsweb-system-workflow/hsweb-system-workflow-local/src/main/java/org/hswebframework/web/workflow/service/imp/ProcessConfigurationServiceImpl.java

@@ -8,6 +8,7 @@ import org.activiti.engine.task.Task;
 import org.apache.commons.codec.digest.DigestUtils;
 import org.hswebframework.expands.script.engine.DynamicScriptEngine;
 import org.hswebframework.expands.script.engine.DynamicScriptEngineFactory;
+import org.hswebframework.expands.script.engine.ExecuteResult;
 import org.hswebframework.web.authorization.Authentication;
 import org.hswebframework.web.authorization.AuthenticationHolder;
 import org.hswebframework.web.authorization.AuthenticationPredicate;
@@ -150,7 +151,10 @@ public class ProcessConfigurationServiceImpl implements ProcessConfigurationServ
             return event -> {
                 Map<String, Object> context = new HashMap<>();
                 context.put("event", event);
-                engine.execute(scriptId, context).getIfSuccess();
+                ExecuteResult result = engine.execute(scriptId, context);
+                if (!result.isSuccess()) {
+                    throw new RuntimeException("执行监听器失败:" + result.getMessage(), result.getException());
+                }
             };
         } else {
             log.warn("不支持的脚本语言:{}", listenerConfig.getLanguage());

+ 8 - 1
hsweb-system/hsweb-system-workflow/hsweb-system-workflow-starter/src/main/java/org/hswebframework/web/workflow/starter/WorkFlowAutoConfiguration.java

@@ -1,10 +1,17 @@
 package org.hswebframework.web.workflow.starter;
 
+import com.alibaba.fastjson.parser.ParserConfig;
+import org.springframework.boot.CommandLineRunner;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.Configuration;
 
 @Configuration
 @ComponentScan("org.hswebframework.web.workflow")
-public class WorkFlowAutoConfiguration {
+public class WorkFlowAutoConfiguration implements CommandLineRunner {
 
+    @Override
+    public void run(String... args) throws Exception {
+        ParserConfig.getGlobalInstance()
+                .addAccept("org.hswebframework.web.workflow.dao.entity");
+    }
 }