liu 2 lat temu
rodzic
commit
1aafd2db40

+ 12 - 1
mhotel/src/com/happy/action/AppBookingCommentAction.java

@@ -3,7 +3,9 @@ package com.happy.action;
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
 import com.happy.Model.BookingComment;
+import com.happy.Model.weixin.Users;
 import com.happy.Until.*;
+import com.happy.dto.BookCommentDto;
 import com.happy.dto.HotelEto;
 import com.happy.dto.IPage;
 import com.happy.dto.OrderRateDto;
@@ -454,13 +456,22 @@ public class AppBookingCommentAction extends ActionSupport implements ServletReq
      */
     public JSONObject replyComment() {
         JSONObject jsonObject = new JSONObject();
-        if (Func.checkNull(content) || Func.checkNull(commentParentId)) {
+        if (Func.checkNull(content) || Func.checkNull(commentParentId)||Func.checkNull(commentId)) {
             jsonObject.put("code", 400);
             jsonObject.put("success", false);
             jsonObject.put("message", "缺少数据---replyComment");
             ResUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
             return null;
         }
+        String commentName=this.commentName;
+        BookingComment byId = bookingCommentService.getBycommentId(commentId);
+        if (byId!=null) {
+            Integer createId1 = byId.getCreateId();
+            Users users = userService.queryByUserId(createId1 + "");
+            if (users!=null) {
+                commentName=users.getUser_name();
+            }
+        }
 
         BookingComment bookingComment = BookingComment.builder().commentId(commentId).commentParentId(commentParentId).commentName(commentName).bookingId(bookingId)
                 .hotelId(hotelId).houseId(houseId).content(content).commentStatus(commentStatus)

+ 1 - 0
mhotel/src/com/happy/dao/BookingCommentDao.java

@@ -53,4 +53,5 @@ public interface BookingCommentDao {
 
     PersonageDetailsVo personageDetails(String bookingCommentId);
 
+    BookingComment getBycommentId(String commentId);
 }

+ 18 - 0
mhotel/src/com/happy/dao/impl/BookingCommentImplDao.java

@@ -658,6 +658,24 @@ public class BookingCommentImplDao implements BookingCommentDao {
         if (list != null && list.size() > 0) return list.get(0);
         return null;
     }
+
+    @Override
+    public BookingComment getBycommentId(String commentId) {
+            String sql="SELECT * FROM `booking_comment` WHERE id= :commentId";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("commentId", commentId);
+        List<BookingComment> list = null;
+        try {
+            list = namedParameterJdbcTemplate.query(sql, sps,
+                    new BeanPropertyRowMapper<>(BookingComment.class));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        if (list != null && list.size() > 0) return list.get(0);
+        return null;
+
+    }
+
     public void appendValue(BookingComment bookingComment, StringBuffer stringBuffer, MapSqlParameterSource sps){
         if (!Func.checkNull(bookingComment.getCommentId())){
             stringBuffer.append(" comment_id=:comment_id ,");

+ 2 - 0
mhotel/src/com/happy/service/BookingCommentService.java

@@ -67,4 +67,6 @@ public interface BookingCommentService {
     //待评级数量,已评价数量
     PersonageCommentCountVo personageCommentCount(String usersId);
 
+    BookingComment getBycommentId(String commentId);
+
 }

+ 5 - 0
mhotel/src/com/happy/service/impl/BookingCommentImplService.java

@@ -280,6 +280,11 @@ public class BookingCommentImplService implements BookingCommentService {
         return vo;
     }
 
+    @Override
+    public BookingComment getBycommentId(String commentId) {
+        return bookingCommentDao.getBycommentId(commentId);
+    }
+
 
     @Override
     public BookCommentDto getById(String bookId) {