UserConnector userConnector = ApplicationContextHelper
.getBean(UserConnector.class);
OrgConnector orgConnector = (OrgConnector) ApplicationContextHelper
.getBean(OrgConnector.class);
ExpressionManager expressionManager = Context
.getProcessEngineConfiguration().getExpressionManager();
MapVariableScope mapVariableScope = new MapVariableScope();
String initiator = historicProcessInstanceEntity.getStartUserId();
mapVariableScope.setVariable("initiator",
userConnector.findById(initiator));
for (BpmConfRule bpmConfRule : bpmConfRules) {
String value = bpmConfRule.getValue();
if ("职位".equals(value)) {
// 获得发起人的职位
int initiatorLevel = orgConnector
.getJobLevelByUserId(initiator);
// 获得审批人的职位
int assigneeLevel = orgConnector
.getJobLevelByUserId(delegateTask.getAssignee());
// 比较
if (initiatorLevel >= assigneeLevel) {
logger.info("skip task : {}", delegateTask.getId());
logger.info("initiatorLevel : {}, assigneeLevel : {}",
initiatorLevel, assigneeLevel);
new CompleteTaskWithCommentCmd(delegateTask.getId(),
Collections.<String, Object> emptyMap(), "跳过")
.execute(Context.getCommandContext());
}
} else {
Boolean result = (Boolean) expressionManager.createExpression(
value).getValue(mapVariableScope);
logger.info("value : {}, result : {}", value, result);
if (result) {