|
@@ -3,8 +3,12 @@ package com.happy.action;
|
|
|
import com.happy.Model.BookingComment;
|
|
import com.happy.Model.BookingComment;
|
|
|
import com.happy.Until.Func;
|
|
import com.happy.Until.Func;
|
|
|
import com.happy.Until.ResUtil;
|
|
import com.happy.Until.ResUtil;
|
|
|
|
|
+import com.happy.Until.ResponseUtil;
|
|
|
|
|
+import com.happy.dto.IPage;
|
|
|
import com.happy.dto.OrderRateDto;
|
|
import com.happy.dto.OrderRateDto;
|
|
|
import com.happy.service.BookingCommentService;
|
|
import com.happy.service.BookingCommentService;
|
|
|
|
|
+import com.happy.vo.BookingCommentPageVo;
|
|
|
|
|
+import com.happy.vo.EvaluatePageVo;
|
|
|
import com.opensymphony.xwork2.ActionSupport;
|
|
import com.opensymphony.xwork2.ActionSupport;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import org.apache.struts2.ServletActionContext;
|
|
import org.apache.struts2.ServletActionContext;
|
|
@@ -54,6 +58,13 @@ public class AppBookingCommentAction extends ActionSupport implements ServletReq
|
|
|
public BookingCommentService bookingCommentService;
|
|
public BookingCommentService bookingCommentService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ // 回复评论id
|
|
|
|
|
+ public String commentId;
|
|
|
|
|
+ // 回复主评论id
|
|
|
|
|
+ public String commentParentId;
|
|
|
|
|
+ // 回复人名称
|
|
|
|
|
+ public String commentName;
|
|
|
|
|
+
|
|
|
// 评论订单id
|
|
// 评论订单id
|
|
|
public String bookingId;
|
|
public String bookingId;
|
|
|
|
|
|
|
@@ -66,6 +77,9 @@ public class AppBookingCommentAction extends ActionSupport implements ServletReq
|
|
|
// 内容
|
|
// 内容
|
|
|
public String content;
|
|
public String content;
|
|
|
|
|
|
|
|
|
|
+ // 评价状态
|
|
|
|
|
+ public String commentStatus;
|
|
|
|
|
+
|
|
|
// 总评分
|
|
// 总评分
|
|
|
public Double score;
|
|
public Double score;
|
|
|
|
|
|
|
@@ -110,6 +124,30 @@ public class AppBookingCommentAction extends ActionSupport implements ServletReq
|
|
|
this.bookingId = bookingId;
|
|
this.bookingId = bookingId;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public String getCommentId() {
|
|
|
|
|
+ return commentId;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void setCommentId(String commentId) {
|
|
|
|
|
+ this.commentId = commentId;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public String getCommentParentId() {
|
|
|
|
|
+ return commentParentId;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void setCommentParentId(String commentParentId) {
|
|
|
|
|
+ this.commentParentId = commentParentId;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public String getCommentName() {
|
|
|
|
|
+ return commentName;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void setCommentName(String commentName) {
|
|
|
|
|
+ this.commentName = commentName;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public String getHotelId() {
|
|
public String getHotelId() {
|
|
|
return hotelId;
|
|
return hotelId;
|
|
|
}
|
|
}
|
|
@@ -206,6 +244,34 @@ public class AppBookingCommentAction extends ActionSupport implements ServletReq
|
|
|
this.modifyDate = modifyDate;
|
|
this.modifyDate = modifyDate;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public int page; // 当前页
|
|
|
|
|
+ public int rows;// 每页显示的行数rows
|
|
|
|
|
+ public int status; //状态,0显示全部,1显示有附件,2显示有回复
|
|
|
|
|
+
|
|
|
|
|
+ public int getPage() {
|
|
|
|
|
+ return page;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void setPage(int page) {
|
|
|
|
|
+ this.page = page;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public int getRows() {
|
|
|
|
|
+ return rows;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void setRows(int rows) {
|
|
|
|
|
+ this.rows = rows;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public int getStatus() {
|
|
|
|
|
+ return status;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void setStatus(int status) {
|
|
|
|
|
+ this.status = status;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 添加评论
|
|
* 添加评论
|
|
|
*/
|
|
*/
|
|
@@ -213,28 +279,32 @@ public class AppBookingCommentAction extends ActionSupport implements ServletReq
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
if (score == null || score < 0 || scoreFw == null || scoreFw < 0 || scoreSs == null || scoreSs < 0 || scoreWs == null || scoreWs < 0 || scoreWz == null || scoreWz < 0 || bookingId == null || hotelId == null || houseId == null) {
|
|
if (score == null || score < 0 || scoreFw == null || scoreFw < 0 || scoreSs == null || scoreSs < 0 || scoreWs == null || scoreWs < 0 || scoreWz == null || scoreWz < 0 || bookingId == null || hotelId == null || houseId == null) {
|
|
|
jsonObject.put("code", 400);
|
|
jsonObject.put("code", 400);
|
|
|
- jsonObject.put("message", "未传入orderRateDto数据---orderRate");
|
|
|
|
|
|
|
+ jsonObject.put("success", false);
|
|
|
|
|
+ jsonObject.put("message", "缺少数据---orderRate");
|
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
BookingComment bookingComment = BookingComment.builder().bookingId(bookingId)
|
|
BookingComment bookingComment = BookingComment.builder().bookingId(bookingId)
|
|
|
- .hotelId(hotelId).houseId(houseId).content(content)
|
|
|
|
|
|
|
+ .hotelId(hotelId).houseId(houseId).content(content).commentStatus(commentStatus)
|
|
|
.score(score).scoreWs(scoreWs).scoreFw(scoreFw)
|
|
.score(score).scoreWs(scoreWs).scoreFw(scoreFw)
|
|
|
.scoreSs(scoreSs).scoreWz(scoreWz).createId(String.valueOf(createId))
|
|
.scoreSs(scoreSs).scoreWz(scoreWz).createId(String.valueOf(createId))
|
|
|
.createUsername(createUsername).createDate(createDate)
|
|
.createUsername(createUsername).createDate(createDate)
|
|
|
.modifyDate(modifyDate).build();
|
|
.modifyDate(modifyDate).build();
|
|
|
|
|
|
|
|
|
|
|
|
|
- int a = bookingCommentService.orderRate(bookingComment,pictureList);
|
|
|
|
|
|
|
+ int a = bookingCommentService.orderRate(bookingComment, pictureList);
|
|
|
|
|
|
|
|
- if (a>0) {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (a > 0) {
|
|
|
jsonObject.put("code", 200);
|
|
jsonObject.put("code", 200);
|
|
|
jsonObject.put("message", "添加成功");
|
|
jsonObject.put("message", "添加成功");
|
|
|
|
|
+ jsonObject.put("success", true);
|
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
jsonObject.put("message", "未知异常");
|
|
jsonObject.put("message", "未知异常");
|
|
|
|
|
+ jsonObject.put("success", false);
|
|
|
jsonObject.put("code", 205);
|
|
jsonObject.put("code", 205);
|
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
|
|
|
return null;
|
|
return null;
|
|
@@ -246,16 +316,84 @@ public class AppBookingCommentAction extends ActionSupport implements ServletReq
|
|
|
*
|
|
*
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
- public JSONObject evaluateList() {
|
|
|
|
|
|
|
+ public JSONObject evaluatePage() {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
if (Func.checkNull(hotelId)) {
|
|
if (Func.checkNull(hotelId)) {
|
|
|
jsonObject.put("code", 400);
|
|
jsonObject.put("code", 400);
|
|
|
- jsonObject.put("message", "未传入hotel_id数据---evaluateList");
|
|
|
|
|
|
|
+ jsonObject.put("success", false);
|
|
|
|
|
+ jsonObject.put("message", "未传入hotel_id数据---evaluatePage");
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (Func.checkNull(status + "")) {
|
|
|
|
|
+ jsonObject.put("code", 400);
|
|
|
|
|
+ jsonObject.put("success", false);
|
|
|
|
|
+ jsonObject.put("message", "未传入status数据---evaluatePage");
|
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if (page <= 0 || rows <= 0) {
|
|
|
|
|
+ jsonObject.put("code", 400);
|
|
|
|
|
+ jsonObject.put("success", false);
|
|
|
|
|
+ jsonObject.put("message", "未传入page,rows数据---evaluatePage");
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+// 获取分页数据
|
|
|
|
|
+ IPage<BookingCommentPageVo> iPage = bookingCommentService.evaluatePage(status, hotelId, page, rows);
|
|
|
|
|
+// 计算评分
|
|
|
|
|
+ EvaluatePageVo vo = bookingCommentService.evaluateScore(hotelId);
|
|
|
|
|
+
|
|
|
|
|
+ jsonObject.put("code", 200);
|
|
|
|
|
+ jsonObject.put("message", "成功");
|
|
|
|
|
+ jsonObject.put("success", true);
|
|
|
|
|
+ jsonObject.put("page", iPage);
|
|
|
|
|
+ jsonObject.put("score", vo);
|
|
|
|
|
+
|
|
|
|
|
+ ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ return null;
|
|
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 回复评论
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public JSONObject replyComment() {
|
|
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
|
|
+ if (Func.checkNull(content) || Func.checkNull(commentParentId)) {
|
|
|
|
|
+ jsonObject.put("code", 400);
|
|
|
|
|
+ jsonObject.put("success", false);
|
|
|
|
|
+ jsonObject.put("message", "缺少数据---replyComment");
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ BookingComment bookingComment = BookingComment.builder().commentId(commentId).commentParentId(commentParentId).commentName(commentName).bookingId(bookingId)
|
|
|
|
|
+ .hotelId(hotelId).houseId(houseId).content(content).commentStatus(commentStatus)
|
|
|
|
|
+ .score(score).scoreWs(scoreWs).scoreFw(scoreFw)
|
|
|
|
|
+ .scoreSs(scoreSs).scoreWz(scoreWz).createId(createId)
|
|
|
|
|
+ .createUsername(createUsername).createDate(createDate)
|
|
|
|
|
+ .modifyDate(modifyDate).build();
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ int i = bookingCommentService.replyComment(bookingComment);
|
|
|
|
|
+ if (i > 0) {
|
|
|
|
|
+ jsonObject.put("code", 200);
|
|
|
|
|
+ jsonObject.put("message", "回复成功");
|
|
|
|
|
+ jsonObject.put("success", true);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ jsonObject.put("message", "未知异常");
|
|
|
|
|
+ jsonObject.put("code", 205);
|
|
|
|
|
+ jsonObject.put("success", false);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
|
|
|
return null;
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
}
|