|
|
@@ -9,8 +9,7 @@ import com.happy.service.BookService;
|
|
|
import com.happy.service.BookingCommentService;
|
|
|
import com.happy.service.FileService;
|
|
|
import com.happy.service.HouseService;
|
|
|
-import com.happy.vo.BookingCommentPageVo;
|
|
|
-import com.happy.vo.EvaluatePageVo;
|
|
|
+import com.happy.vo.*;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
@@ -37,9 +36,8 @@ public class BookingCommentImplService implements BookingCommentService {
|
|
|
FileService fileService;
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
- * �������
|
|
|
+ * 添加评论
|
|
|
*
|
|
|
* @param pictureList
|
|
|
* @param bookingComment
|
|
|
@@ -47,17 +45,17 @@ public class BookingCommentImplService implements BookingCommentService {
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public int orderRate( BookingComment bookingComment,List<String> pictureList) {
|
|
|
+ public int orderRate(BookingComment bookingComment, List<String> pictureList) {
|
|
|
|
|
|
-// ������۱���������
|
|
|
+// 添加评论表并返回主键
|
|
|
|
|
|
String id = bookingCommentDao.insertBookingComment(bookingComment);
|
|
|
int i = 1;
|
|
|
- if (pictureList.size() > 0) {
|
|
|
+ if (pictureList != null && pictureList.size() > 0) {
|
|
|
List<FileInfo> fileInfoList = new ArrayList<>();
|
|
|
for (String s : pictureList) {
|
|
|
String[] split = s.split("/");
|
|
|
- String s1 = split[split.length-1];
|
|
|
+ String s1 = split[split.length - 1];
|
|
|
FileInfo fileInfo = new FileInfo();
|
|
|
fileInfo.setLinkId(id);
|
|
|
fileInfo.setName(s1);
|
|
|
@@ -81,12 +79,12 @@ public class BookingCommentImplService implements BookingCommentService {
|
|
|
IPage<BookingCommentPageVo> iPage = new IPage();
|
|
|
List<BookingCommentPageVo> vos = null;
|
|
|
int total = 0;
|
|
|
-// ȫ��
|
|
|
+// 全部
|
|
|
if (status == 0) {
|
|
|
vos = bookingCommentDao.evaluatePage(hotelId, page, rows);
|
|
|
total = bookingCommentDao.evaluateTotal(hotelId);
|
|
|
} else if (status == 1) {
|
|
|
-// ��ͼ
|
|
|
+// 带图
|
|
|
vos = bookingCommentDao.evaluatePagepicture(hotelId, page, rows);
|
|
|
total = bookingCommentDao.evaluateTotalpicture(hotelId);
|
|
|
} else if (status == 2) {
|
|
|
@@ -100,12 +98,17 @@ public class BookingCommentImplService implements BookingCommentService {
|
|
|
iPage.setPageList(vos);
|
|
|
return iPage;
|
|
|
|
|
|
-
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
public EvaluatePageVo evaluateScore(String hotelId) {
|
|
|
- return bookingCommentDao.evaluateScore(hotelId);
|
|
|
+ return bookingCommentDao.evaluateScore(hotelId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<CommentVo> commentVoList(String bookingCommentId) {
|
|
|
+ return bookingCommentDao.commentVoList(bookingCommentId);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -122,13 +125,13 @@ public class BookingCommentImplService implements BookingCommentService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public IPage<BookingComment> queryPage(String sqlx,String sql, int page, int rows) {
|
|
|
+ public IPage<BookingComment> queryPage(String sqlx, String sql, int page, int rows) {
|
|
|
IPage<BookingComment> iPage = new IPage();
|
|
|
- List<BookingComment> hotelCouponList = bookingCommentDao.queryPage(sqlx,page,rows);
|
|
|
+ List<BookingComment> hotelCouponList = bookingCommentDao.queryPage(sqlx, page, rows);
|
|
|
int total = bookingCommentDao.queryTotal(sql);
|
|
|
iPage.setPageList(hotelCouponList);
|
|
|
iPage.setPage(page);
|
|
|
- iPage.setTotalPage( (int)Math.ceil((double)total/rows));
|
|
|
+ iPage.setTotalPage((int) Math.ceil((double) total / rows));
|
|
|
iPage.setRows(rows);
|
|
|
iPage.setTotal(total);
|
|
|
return iPage;
|
|
|
@@ -151,14 +154,51 @@ public class BookingCommentImplService implements BookingCommentService {
|
|
|
comment.setCommentStatus("2");
|
|
|
int m = bookingCommentDao.updateCommpentStatus(comment);
|
|
|
int i = bookingCommentDao.insterCommpent(bookingComment);
|
|
|
- if (i > 0 && m >0){
|
|
|
+ if (i > 0 && m > 0) {
|
|
|
return i;
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public CommentDetailsVo commentDetails(String bookingId) {
|
|
|
+ return bookingCommentDao.commentDetails(bookingId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public IPage personageComment(int status, String usersId, int page, int rows) {
|
|
|
+ IPage<PersonageCommentVo> iPage = new IPage();
|
|
|
+ List<PersonageCommentVo> vos = null;
|
|
|
+ int total = 0;
|
|
|
+// 待评价
|
|
|
+ if (status == 0) {
|
|
|
+ vos = bookingCommentDao.personageNotCommentPage(usersId, page, rows);
|
|
|
+ total = bookingCommentDao.personageNotCommentTotal(usersId);
|
|
|
+ } else if (status == 1) {
|
|
|
+// 已评价
|
|
|
+ vos = bookingCommentDao.personageCommentPage(usersId, page, rows);
|
|
|
+ total = bookingCommentDao.personageCommentTotal(usersId);
|
|
|
+// } else if (status == 2) {
|
|
|
+// vos = bookingCommentDao.evaluatePageComment(hotelId, page, rows);
|
|
|
+// total = bookingCommentDao.evaluateTotalComment(hotelId);
|
|
|
+ }
|
|
|
+ iPage.setPage(page);
|
|
|
+ iPage.setTotalPage((int) Math.ceil((double) total / rows));
|
|
|
+ iPage.setRows(rows);
|
|
|
+ iPage.setTotal(total);
|
|
|
+ iPage.setPageList(vos);
|
|
|
+ return iPage;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public PersonageDetailsVo personageDetails(String bookingCommentId) {
|
|
|
+ return bookingCommentDao.personageDetails(bookingCommentId);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
public BookCommentDto getById(String bookId) {
|
|
|
List<BookingComment> list = bookingCommentDao.getByBookId(bookId);
|
|
|
if (list == null) return null;
|
|
|
@@ -169,10 +209,10 @@ public class BookingCommentImplService implements BookingCommentService {
|
|
|
List<FileInfo> fileInfos = fileDao.queryList("and link_id ='" + comment.getId() + "'");
|
|
|
bookCommentDto.setFileInfos(fileInfos);
|
|
|
}
|
|
|
- for (BookingComment bookingComment : list){
|
|
|
+ for (BookingComment bookingComment : list) {
|
|
|
List<BookingComment> listByParentId = bookingCommentDao.getByParentId(bookingComment.getId());
|
|
|
List<BookingComment> bookingCommentList = new ArrayList<>();
|
|
|
- for (BookingComment parentComment : listByParentId){
|
|
|
+ for (BookingComment parentComment : listByParentId) {
|
|
|
bookingCommentList.add(getComment(parentComment));
|
|
|
}
|
|
|
bookingComment.setLowCommentList(bookingCommentList);
|
|
|
@@ -180,20 +220,23 @@ public class BookingCommentImplService implements BookingCommentService {
|
|
|
bookCommentDto.setBookingCommentList(list);
|
|
|
return bookCommentDto;
|
|
|
}
|
|
|
- public BookingComment getComment(BookingComment parentComment){
|
|
|
- if(parentComment!=null){
|
|
|
- List<BookingComment> parentCommentList = bookingCommentDao.getByCommentId(parentComment.getId());
|
|
|
- List<BookingComment> list = new ArrayList<>();
|
|
|
- if(parentComment != null && parentCommentList != null){
|
|
|
- for(BookingComment low : parentCommentList){//一级评论
|
|
|
- list.add(low);
|
|
|
- getLowcomment(low,list);
|
|
|
- }
|
|
|
- parentComment.setLowCommentList(list);
|
|
|
- }
|
|
|
- }
|
|
|
- return parentComment;
|
|
|
- };
|
|
|
+
|
|
|
+ public BookingComment getComment(BookingComment parentComment) {
|
|
|
+ if (parentComment != null) {
|
|
|
+ List<BookingComment> parentCommentList = bookingCommentDao.getByCommentId(parentComment.getId());
|
|
|
+ List<BookingComment> list = new ArrayList<>();
|
|
|
+ if (parentComment != null && parentCommentList != null) {
|
|
|
+ for (BookingComment low : parentCommentList) {//一级评论
|
|
|
+ list.add(low);
|
|
|
+ getLowcomment(low, list);
|
|
|
+ }
|
|
|
+ parentComment.setLowCommentList(list);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return parentComment;
|
|
|
+ }
|
|
|
+
|
|
|
+ ;
|
|
|
|
|
|
// private void getLowcomment(BookingComment comment){
|
|
|
// List<BookingComment> list = new ArrayList<>();
|
|
|
@@ -209,13 +252,13 @@ public class BookingCommentImplService implements BookingCommentService {
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
- private void getLowcomment(BookingComment comment,List<BookingComment> parentCommentList){
|
|
|
+ private void getLowcomment(BookingComment comment, List<BookingComment> parentCommentList) {
|
|
|
List<BookingComment> list = new ArrayList<>();
|
|
|
List<BookingComment> low = bookingCommentDao.getByCommentId(comment.getId());
|
|
|
- if(low!=null){
|
|
|
- for(BookingComment low1 : low){
|
|
|
+ if (low != null) {
|
|
|
+ for (BookingComment low1 : low) {
|
|
|
parentCommentList.add(low1);
|
|
|
- getLowcomment(low1,parentCommentList);
|
|
|
+ getLowcomment(low1, parentCommentList);
|
|
|
}
|
|
|
}
|
|
|
}
|