use of com.dimple.project.common.domain.ReplayEmail in project DimpleBlog by martin-chips.
the class FrontServiceImpl method insertComment.
@Override
public int insertComment(Comment comment) {
comment.setAdminReply(SecurityUtils.isAdmin());
final UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent"));
comment.setOs(userAgent.getOperatingSystem().getName());
comment.setBrowser(userAgent.getBrowser().getName());
comment.setDisplay(true);
comment.setIp(IpUtils.getIpAddr(ServletUtils.getRequest()));
comment.setLocation(AddressUtils.getCityInfoByIp(comment.getIp()));
if (comment.getParentId() != null) {
Comment tempComment = frontMapper.selectCommentById(comment.getParentId());
String title = frontMapper.selectBlogTitleById(comment.getPageId());
if (tempComment.getReply()) {
ReplayEmail replayEmail = new ReplayEmail();
replayEmail.setCreateTime(tempComment.getCreateTime());
replayEmail.setOriginContent(tempComment.getHtmlContent());
replayEmail.setReplyContent(comment.getHtmlContent());
replayEmail.setUrl(comment.getUrl());
replayEmail.setTitle(title);
AsyncManager.me().execute(AsyncFactory.sendReplyEmail(comment.getUrl(), comment.getHtmlContent(), comment.getNickName(), tempComment.getEmail(), replayEmail));
}
}
return frontMapper.insertComment(comment);
}
Aggregations