Ver código fonte

添加评论后显示未评价的订单

liu 2 anos atrás
pai
commit
0f934c57e5

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

@@ -8,6 +8,7 @@ import com.happy.dto.HotelEto;
 import com.happy.dto.IPage;
 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.service.UserService;
 import com.happy.vo.*;
 import com.happy.vo.*;
 import com.opensymphony.xwork2.ActionSupport;
 import com.opensymphony.xwork2.ActionSupport;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
@@ -56,10 +57,11 @@ public class AppBookingCommentAction extends ActionSupport implements ServletReq
         this.response = response;
         this.response = response;
     }
     }
 
 
-
     @Resource
     @Resource
     public BookingCommentService bookingCommentService;
     public BookingCommentService bookingCommentService;
 
 
+    @Resource
+    public UserService userService;
 
 
     //    回复评论id
     //    回复评论id
     public String commentId;
     public String commentId;
@@ -296,6 +298,16 @@ public class AppBookingCommentAction extends ActionSupport implements ServletReq
         this.usersId = usersId;
         this.usersId = usersId;
     }
     }
 
 
+    public Integer userId;
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
     /**
     /**
      * 添加评论
      * 添加评论
      */
      */
@@ -343,6 +355,7 @@ public class AppBookingCommentAction extends ActionSupport implements ServletReq
 
 
 
 
         if (a > 0) {
         if (a > 0) {
+
             jsonObject.put("code", 200);
             jsonObject.put("code", 200);
             jsonObject.put("message", "添加成功");
             jsonObject.put("message", "添加成功");
             jsonObject.put("success", true);
             jsonObject.put("success", true);
@@ -356,6 +369,35 @@ public class AppBookingCommentAction extends ActionSupport implements ServletReq
         return null;
         return null;
     }
     }
 
 
+    public JSONObject unevaluatedOrder(){
+        JSONObject jsonObject = new JSONObject();
+        if (page <= 0 || rows <= 0) {
+            jsonObject.put("code", 400);
+            jsonObject.put("success", false);
+            jsonObject.put("message", "未传入page,rows数据---unevaluatedOrder");
+            ResUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+        if (Func.checkNull(hotelId)||Func.checkNull(userId+"")) {
+            jsonObject.put("code", 400);
+            jsonObject.put("success", false);
+            jsonObject.put("message", "未传入hotelId,usersId数据---unevaluatedOrder");
+            ResUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+
+        UnevaluatedOrder vo=userService.collect(hotelId,userId);
+        IPage<PersonageCommentVo> iPage = bookingCommentService.personageComment(0, userId+"", page, rows);
+        vo.setPage(iPage);
+
+        jsonObject.put("code", 200);
+        jsonObject.put("message", "查看成功");
+        jsonObject.put("success", true);
+        jsonObject.put("data", vo);
+        ResUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+        return null;
+    }
+
 
 
     /**
     /**
      * 评价列表
      * 评价列表

+ 4 - 0
mhotel/src/com/happy/dao/UserDao.java

@@ -1,6 +1,7 @@
 package com.happy.dao;
 package com.happy.dao;
 
 
 import com.happy.Model.weixin.Users;
 import com.happy.Model.weixin.Users;
+import com.happy.vo.UnevaluatedOrder;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -40,4 +41,7 @@ public interface UserDao {
 
 
     public int queryUserTotal(String sqlStr);
     public int queryUserTotal(String sqlStr);
     public List<Users> queryUserPage(String sqlx, int page, int rows);
     public List<Users> queryUserPage(String sqlx, int page, int rows);
+
+    UnevaluatedOrder collect(String hotelId1, Integer createId1);
+
 }
 }

+ 23 - 0
mhotel/src/com/happy/dao/impl/UserDaoImpl.java

@@ -5,6 +5,7 @@ import com.happy.Model.weixin.Users;
 import com.happy.Until.Func;
 import com.happy.Until.Func;
 import com.happy.Until.UUIDUtil;
 import com.happy.Until.UUIDUtil;
 import com.happy.dao.UserDao;
 import com.happy.dao.UserDao;
+import com.happy.vo.UnevaluatedOrder;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
 import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
@@ -264,4 +265,26 @@ public class UserDaoImpl implements UserDao {
         return new ArrayList<>();
         return new ArrayList<>();
     }
     }
 
 
+    @Override
+    public UnevaluatedOrder collect(String hotelId, Integer createId) {
+        String sql = "SELECT\n" +
+                "\t( SELECT h.cover_img FROM hotel h WHERE h.id = :hotelId AND h.`status` = 1 ) as url,\n" +
+                "\t( SELECT hname FROM hotel  WHERE id = :hotelId AND `status` = 1 ) as name,\n" +
+                "\tCOUNT( * ) as count \n" +
+                "FROM\n" +
+                "\t`users` u \n" +
+                "WHERE\n" +
+                "\tu.id = :createId \n" +
+                "\tAND FIND_IN_SET( :hotelId, u.collect_hotel )";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("hotelId", hotelId);
+        sps.addValue("createId", createId);
+        List<UnevaluatedOrder> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(UnevaluatedOrder.class));
+        if (list != null && list.size() > 0) {
+            return list.get(0);
+        }
+        return null;
+    }
+
 }
 }

+ 9 - 0
mhotel/src/com/happy/service/UserService.java

@@ -4,6 +4,7 @@ import com.happy.Model.Booking;
 import com.happy.Model.weixin.Users;
 import com.happy.Model.weixin.Users;
 import com.happy.Until.Enum.TempEnum;
 import com.happy.Until.Enum.TempEnum;
 import com.happy.dto.IPage;
 import com.happy.dto.IPage;
+import com.happy.vo.UnevaluatedOrder;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -55,4 +56,12 @@ public interface UserService {
      * @return
      * @return
      */
      */
     Users delhotelAndUsers(String hotelId, String userId, TempEnum type);
     Users delhotelAndUsers(String hotelId, String userId, TempEnum type);
+
+    /**
+     * 通过酒店id,用户id判断酒店是否收藏
+     * @param hotelId1
+     * @param createId1
+     * @return
+     */
+    UnevaluatedOrder collect(String hotelId1, Integer createId1);
 }
 }

+ 12 - 1
mhotel/src/com/happy/service/impl/UserServiceImpl.java

@@ -13,6 +13,7 @@ import com.happy.dao.UserDao;
 import com.happy.dto.IPage;
 import com.happy.dto.IPage;
 import com.happy.service.HotelService;
 import com.happy.service.HotelService;
 import com.happy.service.UserService;
 import com.happy.service.UserService;
+import com.happy.vo.UnevaluatedOrder;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
 import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
@@ -141,7 +142,17 @@ public class UserServiceImpl implements UserService {
         return users;
         return users;
     }
     }
 
 
-
+    @Override
+    public UnevaluatedOrder collect(String hotelId1, Integer createId1) {
+        UnevaluatedOrder vo=userDao.collect(hotelId1,createId1);
+        Integer count = vo.getCount();
+        if (count<=0) {
+            vo.setIsCollect(false);
+        }else {
+            vo.setIsCollect(true);
+        }
+        return vo;
+    }
 
 
 
 
 }
 }

+ 20 - 0
mhotel/src/com/happy/vo/PersonageCommentVo.java

@@ -26,6 +26,26 @@ public class PersonageCommentVo {
 //    图片
 //    图片
     private String url;
     private String url;
 
 
+//酒店id
+    private String hotelId;
+//    房间id
+    private String houseId;
+
+    public String getHotelId() {
+        return hotelId;
+    }
+
+    public void setHotelId(String hotelId) {
+        this.hotelId = hotelId;
+    }
+
+    public String getHouseId() {
+        return houseId;
+    }
+
+    public void setHouseId(String houseId) {
+        this.houseId = houseId;
+    }
 
 
     public String getUrl() {
     public String getUrl() {
         return url;
         return url;

+ 17 - 0
mhotel/src/com/happy/vo/UnevaluatedOrder.java

@@ -0,0 +1,17 @@
+package com.happy.vo;
+
+import com.happy.dto.IPage;
+import lombok.Data;
+
+@Data
+public class UnevaluatedOrder {
+    private String name;
+
+    private String url;
+
+    private Integer count;
+
+    private Boolean IsCollect;
+
+    private IPage<PersonageCommentVo> page;
+}