use of com.zyd.blog.business.entity.Comment in project OneBlog by zhangyd-c.
the class BizCommentServiceImpl method findPageBreakByCondition.
/**
* 分页查询
*
* @param vo
* @return
*/
@Override
public PageInfo<Comment> findPageBreakByCondition(CommentConditionVO vo) {
PageHelper.startPage(vo.getPageNumber(), vo.getPageSize());
List<BizComment> list = bizCommentMapper.findPageBreakByCondition(vo);
List<Comment> boList = this.getComments(list);
if (boList == null) {
return null;
}
PageInfo bean = new PageInfo<BizComment>(list);
bean.setList(boList);
return bean;
}
use of com.zyd.blog.business.entity.Comment in project OneBlog by zhangyd-c.
the class BizCommentServiceImpl method sendEmail.
private void sendEmail(Comment comment) {
// 可以进行日志记录等操作
try {
if (null != comment.getPid() && 0 != comment.getPid()) {
// 给被评论的用户发送通知
Comment commentDB = this.getByPrimaryKey(comment.getPid());
mailService.send(commentDB, TemplateKeyEnum.TM_COMMENT_REPLY, false);
} else {
mailService.sendToAdmin(comment);
}
} catch (Exception e) {
log.error("发送评论通知邮件时发生异常", e);
}
}
use of com.zyd.blog.business.entity.Comment in project OneBlog by zhangyd-c.
the class BizCommentServiceImplTest method comment.
@Test
public void comment() throws InterruptedException {
Comment comment = new Comment();
comment.setPid(1L);
comment.setNickname("测试");
comment.setEmail("843977358@qq.com");
comment.setQq("843977358");
commentService.comment(comment);
TimeUnit.SECONDS.sleep(60);
}
use of com.zyd.blog.business.entity.Comment in project OneBlog by zhangyd-c.
the class BizCommentServiceImpl method convert2DTO.
private List<BizCommentDTO> convert2DTO(List<Comment> list) {
if (CollectionUtils.isEmpty(list)) {
return null;
}
List<BizCommentDTO> dtoList = new LinkedList<>();
for (Comment comment : list) {
BizCommentDTO dto = BeanConvertUtil.doConvert(comment, BizCommentDTO.class);
dto.setParentDTO(BeanConvertUtil.doConvert(comment.getParent(), BizCommentDTO.class));
if (null != comment.getUser()) {
dto.setUserType(comment.getUser().getUserTypeEnum());
}
dtoList.add(dto);
}
return dtoList;
}
use of com.zyd.blog.business.entity.Comment in project OneBlog by zhangyd-c.
the class BizCommentServiceImpl method getByPrimaryKey.
@Override
public Comment getByPrimaryKey(Long primaryKey) {
Assert.notNull(primaryKey, "PrimaryKey不可为空!");
BizComment entity = bizCommentMapper.getById(primaryKey);
return null == entity ? null : new Comment(entity);
}
Aggregations