delegateTask.getAssignee()).getDisplayName());
taskEntity.setVariableLocal("initiator",
getInitiator(userConnector, delegateTask));
String receiver = bpmConfNotice.getReceiver();
BpmMailTemplate bpmMailTemplate = bpmConfNotice.getBpmMailTemplate();
ExpressionManager expressionManager = Context
.getProcessEngineConfiguration().getExpressionManager();
UserDTO userDto = null;
if ("任务接收人".equals(receiver)) {
userDto = userConnector.findById(delegateTask.getAssignee());
} else if ("流程发起人".equals(receiver)) {
userDto = userConnector.findById((String) delegateTask
.getVariables().get("initiator"));
} else {
HistoricProcessInstanceEntity historicProcessInstanceEntity = Context
.getCommandContext()
.getHistoricProcessInstanceEntityManager()
.findHistoricProcessInstance(
delegateTask.getProcessInstanceId());
userDto = userConnector.findById(historicProcessInstanceEntity
.getStartUserId());
}
String subject = expressionManager
.createExpression(bpmMailTemplate.getSubject())
.getValue(taskEntity).toString();
String content = expressionManager
.createExpression(bpmMailTemplate.getContent())
.getValue(taskEntity).toString();
this.sendMail(userDto, subject, content);
this.sendSiteMessage(userDto, subject, content);
}