修复计算量BUG
This commit is contained in:
parent
098b1cd341
commit
205f8e8cf6
@ -34,7 +34,7 @@ public class CalcJob implements Job {
|
|||||||
log.error("expression is null, calcModule={}", calcModule.getName());
|
log.error("expression is null, calcModule={}", calcModule.getName());
|
||||||
throw new JobExecutionException("expression is null");
|
throw new JobExecutionException("expression is null");
|
||||||
}
|
}
|
||||||
Map<String,Object> envs = expression.newEnv("G_DEVICES", cacheService.getEquipmentCache().getDevicesCache());
|
Map<String,Object> envs = expression.newEnv("G_DEVICES", cacheService.getEquipmentCache().getDevicesCache(), "G_WINDFARM");
|
||||||
Object result = expression.execute(envs);
|
Object result = expression.execute(envs);
|
||||||
sw.stop();
|
sw.stop();
|
||||||
log.debug("任务[{}]已执行,结果:{}, 耗时:{}秒", calcModule.getName(), result, sw.getTotalTimeMillis()/1000.0);
|
log.debug("任务[{}]已执行,结果:{}, 耗时:{}秒", calcModule.getName(), result, sw.getTotalTimeMillis()/1000.0);
|
||||||
|
@ -73,6 +73,7 @@ public class CalcService {
|
|||||||
if (sh.checkExists(jobKey)){
|
if (sh.checkExists(jobKey)){
|
||||||
throw new SchedulerException("计算模块已启动,请先停止该模块");
|
throw new SchedulerException("计算模块已启动,请先停止该模块");
|
||||||
}
|
}
|
||||||
|
aviator.compile(scriptModule.getName(), scriptModule.getScript(), true);
|
||||||
JobDetail jobDetail = JobBuilder
|
JobDetail jobDetail = JobBuilder
|
||||||
.newJob(CalcJob.class)
|
.newJob(CalcJob.class)
|
||||||
.setJobData(dataMap)
|
.setJobData(dataMap)
|
||||||
@ -95,6 +96,7 @@ public class CalcService {
|
|||||||
JobKey jobKey = JobKey.jobKey(name, "CalcEngine");
|
JobKey jobKey = JobKey.jobKey(name, "CalcEngine");
|
||||||
if (sh.checkExists(jobKey)){
|
if (sh.checkExists(jobKey)){
|
||||||
sh.deleteJob(jobKey);
|
sh.deleteJob(jobKey);
|
||||||
|
aviator.invalidateCacheByKey(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user