Commit f0622517532c2d2a9abe74829b95efbb069e3c19

Authored by 徐烜
1 parent cca5d027

drools配置修正,把函数定义放在META-INF/drools.packagebuilder.conf文件中

src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
@@ -19,6 +19,7 @@ import org.kie.api.runtime.KieSession; @@ -19,6 +19,7 @@ import org.kie.api.runtime.KieSession;
19 import org.slf4j.Logger; 19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory; 20 import org.slf4j.LoggerFactory;
21 import org.springframework.beans.factory.annotation.Autowired; 21 import org.springframework.beans.factory.annotation.Autowired;
  22 +import org.springframework.beans.factory.annotation.Qualifier;
22 import org.springframework.stereotype.Service; 23 import org.springframework.stereotype.Service;
23 import org.springframework.transaction.annotation.Isolation; 24 import org.springframework.transaction.annotation.Isolation;
24 import org.springframework.transaction.annotation.Propagation; 25 import org.springframework.transaction.annotation.Propagation;
@@ -34,16 +35,16 @@ import java.util.concurrent.locks.ReentrantLock; @@ -34,16 +35,16 @@ import java.util.concurrent.locks.ReentrantLock;
34 */ 35 */
35 @Service 36 @Service
36 public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> implements SchedulePlanService { 37 public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> implements SchedulePlanService {
37 -// @Autowired  
38 -// @Qualifier("coreKBase") 38 + @Autowired
  39 + @Qualifier("coreKBase")
39 private KieBase coreKBase; 40 private KieBase coreKBase;
40 41
41 -// @Autowired  
42 -// @Qualifier("preKBase") 42 + @Autowired
  43 + @Qualifier("preKBase")
43 private KieBase preKBase; 44 private KieBase preKBase;
44 45
45 -// @Autowired  
46 -// @Qualifier("KBase3") 46 + @Autowired
  47 + @Qualifier("KBase3")
47 private KieBase validateKBase; 48 private KieBase validateKBase;
48 49
49 @Autowired 50 @Autowired
src/main/java/com/bsth/service/schedule/impl/plan/MyDroolsConfiguration.java
@@ -14,11 +14,12 @@ import org.kie.api.runtime.conf.ClockTypeOption; @@ -14,11 +14,12 @@ import org.kie.api.runtime.conf.ClockTypeOption;
14 import org.slf4j.Logger; 14 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory; 15 import org.slf4j.LoggerFactory;
16 import org.springframework.context.annotation.Bean; 16 import org.springframework.context.annotation.Bean;
  17 +import org.springframework.context.annotation.Configuration;
17 18
18 /** 19 /**
19 * Drools 6配置类。 20 * Drools 6配置类。
20 */ 21 */
21 -//@Configuration 22 +@Configuration
22 public class MyDroolsConfiguration { 23 public class MyDroolsConfiguration {
23 /** 日志记录器 */ 24 /** 日志记录器 */
24 private static final Logger logger = LoggerFactory.getLogger(MyDroolsConfiguration.class); 25 private static final Logger logger = LoggerFactory.getLogger(MyDroolsConfiguration.class);
src/main/resources/META-INF/drools.packagebuilder.conf 0 → 100644
  1 +# 貌似用import accumulate报错,使用配置文件方式
  2 +
  3 +drools.accumulate.function.gidscount = com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.GidsCountFunction
  4 +drools.accumulate.function.gidfbtime = com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.GidFbTimeFunction
  5 +drools.accumulate.function.gidfbfcno = com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.GidFbFcnoFunction
  6 +
  7 +drools.accumulate.function.lpinforesult = com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResultsFunction
  8 +drools.accumulate.function.minruleqyrq = com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.MinRuleQyrqFunction
  9 +
  10 +drools.accumulate.function.vrb = com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidRepeatBcFunction
  11 +drools.accumulate.function.vwrb = com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidWholeRerunBcFunction
  12 +drools.accumulate.function.vwlp = com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidWantLpFunction