package com.yeshi.buwan.service.imp.push;
|
|
import java.util.List;
|
|
import javax.annotation.Resource;
|
|
import org.springframework.stereotype.Service;
|
|
import com.yeshi.buwan.dao.push.VideoPushHistoryDao;
|
import com.yeshi.buwan.domain.Comment2;
|
import com.yeshi.buwan.domain.CommentReply;
|
import com.yeshi.buwan.domain.user.LoginUser;
|
import com.yeshi.buwan.domain.push.VideoPushHistory;
|
import com.yeshi.buwan.service.imp.CommentService;
|
import com.yeshi.buwan.util.StringUtil;
|
import com.yeshi.buwan.util.XingePushUtil;
|
|
@Service
|
public class PushService {
|
@Resource
|
private VideoPushHistoryDao videoPushHistoryDao;
|
@Resource
|
private CommentService commentService;
|
|
|
public void addVideoPushHistory(VideoPushHistory vh) {
|
videoPushHistoryDao.create(vh);
|
}
|
|
public void updateVideoPushHistory(VideoPushHistory vh) {
|
videoPushHistoryDao.update(vh);
|
}
|
|
public VideoPushHistory getVideoPushHistory(String id) {
|
return videoPushHistoryDao.find(VideoPushHistory.class, id);
|
}
|
|
public List<VideoPushHistory> getUnPushVideoPushHistory() {
|
return videoPushHistoryDao
|
.list("from VideoPushHistory vh where vh.videoInfo.show=1 and (vh.pushtime is null or vh.pushtime='')");
|
}
|
|
// 推送评论
|
public void pushCommentReplay(String commentid, String commentReplayId, String replyId) {
|
LoginUser loginUser = null;
|
if (!StringUtil.isNullOrEmpty(commentReplayId)) {
|
CommentReply cr = commentService.getCommentReplay(commentReplayId);
|
loginUser = cr.getUser();
|
} else {
|
Comment2 c2 = commentService.getComment2ById(commentid);
|
loginUser = c2.getUser();
|
}
|
LoginUser owner = commentService.getCommentReplay(replyId).getUser();
|
if (loginUser != null && owner != null) {// 不为空
|
String messageStr = owner.getName() + " 回复了您的评论,赶快去看看吧";
|
XingePushUtil.pushCommentMessage(messageStr, loginUser.getId());
|
}
|
}
|
|
}
|