/**
* 根據流程實例查詢流程的批注信息
*
* @param processInstanceId
* @return
*/
private List<Comment> findCommentByProcessInstanceId(String processInstanceId) {
return taskService.getProcessInstanceComments(processInstanceId);
}
默認獲取到的Comment是沒有getMessage()方法的,只有getFullMessage(),getFullMessage會跟隨部署的系統編碼,保存到數據庫中的bolb字段可能會出現亂碼,但是message字段不是亂碼,如果審批備注只是文字的話,可以直接取message字段的值。
查看源碼得知,CommentEntityImpl 實現了Comment類接口,既可以把Comment 轉換為CommentEntityImpl,直接用其中的getMessage()方法即可。
List<Comment> list = findCommentByProcessInstanceId(processInstanceId);
for (Comment commentEntity : list) {
CommentEntityImpl comment = null;
if(commentEntity instanceof CommentEntityImpl){
comment = (CommentEntityImpl)commentEntity;
}
String message = comment.getMessage();
