Browse Source

修改领券中心显示问题

liu 2 years ago
parent
commit
6b56420fee

+ 4 - 2
mhotel/src/com/happy/action/AppHotelCouponAction.java

@@ -202,15 +202,17 @@ public class AppHotelCouponAction extends ActionSupport implements ServletReques
      */
     public JSONObject couponCollection() {
         JSONObject jsonObject = new JSONObject();
-        if (page <= 0 || rows <= 0) {
+        if (page <= 0 || rows <= 0||Func.checkNull(userId)) {
             jsonObject.put("code", 400);
             jsonObject.put("success", false);
             jsonObject.put("message", "未传入page,rows数据---evaluatePage");
             ResUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
             return null;
         }
+
+
         String date = DateUtil.getFormatPaternDate(new Date());
-        IPage<CouponCollectionVo> iPage = hotelCoupomService.couponCollection(date, page, rows);
+        IPage<CouponCollectionVo> iPage = hotelCoupomService.couponCollection(date, page, rows,userId);
         jsonObject.put("code", 200);
         jsonObject.put("success", true);
         jsonObject.put("message", "成功");

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

@@ -54,4 +54,13 @@ public interface BookingCommentDao {
     PersonageDetailsVo personageDetails(String bookingCommentId);
 
     BookingComment getBycommentId(String commentId);
+
+    List<PersonageCommentVo> auditPageComment(String usersId, int page, int rows);
+
+    int auditTotalComment(String usersId);
+
+    List<PersonageCommentVo> refuseAuditPageComment(String usersId, int page, int rows);
+
+    int refuseAuditTotalComment(String usersId);
+
 }

+ 1 - 1
mhotel/src/com/happy/dao/HotelCouponDao.java

@@ -64,7 +64,7 @@ public interface HotelCouponDao {
 
     int updateLapse(List<String> coupomIds);
 
-    List<CouponCollectionVo> couponCollection(String date, int page, int rows);
+    List<CouponCollectionVo> couponCollection(String date, int page, int rows,String userId);
 
     int couponCollectionTotal(String date);
 

+ 106 - 2
mhotel/src/com/happy/dao/impl/BookingCommentImplDao.java

@@ -70,7 +70,7 @@ public class BookingCommentImplDao implements BookingCommentDao {
         sps.addValue("create_username", bookingComment.getCreateUsername());
         sps.addValue("create_date", bookingComment.getCreateDate());
         sps.addValue("modify_date", bookingComment.getModifyDate());
-        sps.addValue("status", 1);
+        sps.addValue("status", 2);
 
         String id = "";
         if (bookingComment.getId() == null) {
@@ -521,7 +521,7 @@ public class BookingCommentImplDao implements BookingCommentDao {
                 "\t,b.create_userid ,fi.url as url\n" +
                 "FROM\n" +
                 "\t`booking` b\n" +
-                "\tLEFT JOIN booking_comment bc on b.id=bc.booking_id AND bc.comment_parent_id IS NULL  AND bc.`status`=1\n" +
+                "\tLEFT JOIN booking_comment bc on b.id=bc.booking_id AND bc.comment_parent_id IS NULL  AND bc.`status`!=0\n" +
                 "\t\n" +
                 "\tLEFT JOIN users u on u.id =b.create_userid LEFT JOIN file_info fi on fi.link_id=b.house_id\n" +
                 "\t\n" +
@@ -676,6 +676,110 @@ public class BookingCommentImplDao implements BookingCommentDao {
 
     }
 
+    @Override
+    public List<PersonageCommentVo> auditPageComment(String usersId, int page, int rows) {
+        int start = (page - 1) * rows;// ÿҳµÄÆðʼÏÂ
+        String sql = "SELECT\n" +
+                "\tb.id AS id,\n" +
+                "\tbc.id AS bookingCommentId,\n" +
+                "\tb.hotel_name AS hotelName,\n" +
+                "\tb.house_order_number AS houseOrderNumber,\n" +
+                "\tb.house_name AS houseName,\n" +
+                "\tb.live_time AS liveTime,\n" +
+                "\tb.check_out_time AS checkOutTime,\n" +
+                "\tb.pay_account AS payAccount ,fi.url as url\n" +
+                "FROM\n" +
+                "\t`booking` b\n" +
+                "\tINNER JOIN booking_comment bc ON b.id = bc.booking_id \n" +
+                "\tAND bc.comment_parent_id IS NULL \n" +
+                "\tAND bc.`status` = 2\n" +
+                "\tLEFT JOIN users u ON u.id = b.create_userid  LEFT JOIN file_info fi on fi.link_id=b.house_id \n" +
+                "WHERE\n" +
+                "\tu.id = :usersId \n" +
+                "\tAND b.order_status = 5 \n" +
+                "\tAND b.status_del =1  ORDER BY b.order_start_time DESC LIMIT :start,:rows";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("start", start);
+        sps.addValue("rows", rows);
+        sps.addValue("usersId", usersId);
+        List<PersonageCommentVo> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(PersonageCommentVo.class));
+        if (list != null && list.size() > 0) return list;
+
+        return null;
+    }
+
+    @Override
+    public int auditTotalComment(String usersId) {
+        String sql = "SELECT\n" +
+                "\t count(1) \n" +
+                "FROM\n" +
+                "\t`booking` b\n" +
+                "\tINNER JOIN booking_comment bc ON b.id = bc.booking_id \n" +
+                "\tAND bc.comment_parent_id IS NULL \n" +
+                "\tAND bc.`status` = 2\n" +
+                "\tLEFT JOIN users u ON u.id = b.create_userid LEFT JOIN file_info fi on fi.link_id=b.house_id \n" +
+                "WHERE\n" +
+                "\tu.id = :usersId \n" +
+                "\tAND b.order_status = 5 \n" +
+                "\tAND b.status_del =1 ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("usersId", usersId);
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
+
+    @Override
+    public List<PersonageCommentVo> refuseAuditPageComment(String usersId, int page, int rows) {
+        int start = (page - 1) * rows;// ÿҳµÄÆðʼÏÂ
+        String sql = "SELECT\n" +
+                "\tb.id AS id,\n" +
+                "\tbc.id AS bookingCommentId,\n" +
+                "\tb.hotel_name AS hotelName,\n" +
+                "\tb.house_order_number AS houseOrderNumber,\n" +
+                "\tb.house_name AS houseName,\n" +
+                "\tb.live_time AS liveTime,\n" +
+                "\tb.check_out_time AS checkOutTime,\n" +
+                "\tb.pay_account AS payAccount ,fi.url as url\n" +
+                "FROM\n" +
+                "\t`booking` b\n" +
+                "\tINNER JOIN booking_comment bc ON b.id = bc.booking_id \n" +
+                "\tAND bc.comment_parent_id IS NULL \n" +
+                "\tAND bc.`status` = 3\n" +
+                "\tLEFT JOIN users u ON u.id = b.create_userid  LEFT JOIN file_info fi on fi.link_id=b.house_id \n" +
+                "WHERE\n" +
+                "\tu.id = :usersId \n" +
+                "\tAND b.order_status = 5 \n" +
+                "\tAND b.status_del =1  ORDER BY b.order_start_time DESC LIMIT :start,:rows";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("start", start);
+        sps.addValue("rows", rows);
+        sps.addValue("usersId", usersId);
+        List<PersonageCommentVo> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(PersonageCommentVo.class));
+        if (list != null && list.size() > 0) return list;
+
+        return null;
+    }
+
+    @Override
+    public int refuseAuditTotalComment(String usersId) {
+        String sql = "SELECT\n" +
+                "\t count(1) \n" +
+                "FROM\n" +
+                "\t`booking` b\n" +
+                "\tINNER JOIN booking_comment bc ON b.id = bc.booking_id \n" +
+                "\tAND bc.comment_parent_id IS NULL \n" +
+                "\tAND bc.`status` = 3\n" +
+                "\tLEFT JOIN users u ON u.id = b.create_userid LEFT JOIN file_info fi on fi.link_id=b.house_id \n" +
+                "WHERE\n" +
+                "\tu.id = :usersId \n" +
+                "\tAND b.order_status = 5 \n" +
+                "\tAND b.status_del =1 ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("usersId", usersId);
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
+
     public void appendValue(BookingComment bookingComment, StringBuffer stringBuffer, MapSqlParameterSource sps){
         if (!Func.checkNull(bookingComment.getCommentId())){
             stringBuffer.append(" comment_id=:comment_id ,");

+ 3 - 2
mhotel/src/com/happy/dao/impl/HotelCouponImplDao.java

@@ -204,7 +204,7 @@ public class HotelCouponImplDao implements HotelCouponDao {
     }
 
  @Override
-    public List<CouponCollectionVo> couponCollection(String dateTime, int page, int rows) {
+    public List<CouponCollectionVo> couponCollection(String dateTime, int page, int rows,String userId) {
         int start = (page - 1) * rows;// 每页的起始下标
         String sql="SELECT\n" +
                 "\t hc.id as id,hc.hotelIds as hotelIds,\n" +
@@ -214,7 +214,7 @@ public class HotelCouponImplDao implements HotelCouponDao {
                 "\thc.deduction_price as deductionPrice,\n" +
                 "\thc.max_deduction AS maxDeduction,\n" +
                 "\thc.meet_price as meetPrice,\n" +
-                "\thc.grant_start_date AS  effectiveStartDate,(SELECT COUNT( hcs.complaint_id ) AS totalCount FROM `hotel_coupon_status` hcs WHERE hcs.complaint_id = hc.id ) AS totalCount, hc.limit_number as limitNumber,hc.remainder_number as remainderNumber, \n" +
+                "\thc.grant_start_date AS  effectiveStartDate,(SELECT COUNT( hcs.complaint_id ) AS totalCount FROM `hotel_coupon_status` hcs WHERE hcs.complaint_id = hc.id and hcs.create_id =:userId ) AS totalCount, hc.limit_number as limitNumber,hc.remainder_number as remainderNumber, \n" +
                 "\thc.grant_end_date AS effectiveEndDate \n" +
                 "FROM\n" +
                 "\t`hotel_coupon` hc     where hc.grant_start_date < :dateTime and hc.grant_end_date> :dateTime and hc.`status` = 1  ORDER BY hc.effective_start_date DESC limit :start,:rows";
@@ -223,6 +223,7 @@ public class HotelCouponImplDao implements HotelCouponDao {
         sps.addValue("dateTime", dateTime);
         sps.addValue("start", start);
         sps.addValue("rows", rows);
+        sps.addValue("userId", userId);
         List<CouponCollectionVo> list = null;
         try{
             list = namedParameterJdbcTemplate.query(sql, sps,new BeanPropertyRowMapper<>(CouponCollectionVo.class));

+ 1 - 1
mhotel/src/com/happy/service/HotelCoupomService.java

@@ -63,7 +63,7 @@ public interface HotelCoupomService {
     int updateLapse(List<String> coupomIds);
 
 
-    IPage<CouponCollectionVo> couponCollection(String date, int page, int rows);
+    IPage<CouponCollectionVo> couponCollection(String date, int page, int rows,String userId);
 
     DesignatedHotelVo designatedHotel(String hotelIds);
 

+ 8 - 3
mhotel/src/com/happy/service/impl/BookingCommentImplService.java

@@ -225,9 +225,14 @@ public class BookingCommentImplService implements BookingCommentService {
 //            已评价
             vos = bookingCommentDao.personageCommentPage(usersId, page, rows);
             total = bookingCommentDao.personageCommentTotal(usersId);
-//        } else if (status == 2) {
-//            vos = bookingCommentDao.evaluatePageComment(hotelId, page, rows);
-//            total = bookingCommentDao.evaluateTotalComment(hotelId);
+        } else if (status == 2) {
+//            待审核
+            vos = bookingCommentDao.auditPageComment(usersId, page, rows);
+            total = bookingCommentDao.auditTotalComment(usersId);
+        }else if (status == 3) {
+//            审批拒绝
+            vos = bookingCommentDao.refuseAuditPageComment(usersId, page, rows);
+            total = bookingCommentDao.refuseAuditTotalComment(usersId);
         }
         iPage.setPage(page);
         iPage.setTotalPage((int) Math.ceil((double) total / rows));

+ 2 - 2
mhotel/src/com/happy/service/impl/HotelCoupomImplService.java

@@ -106,9 +106,9 @@ public class HotelCoupomImplService implements HotelCoupomService {
      * @return
      */
     @Override
-    public IPage<CouponCollectionVo> couponCollection(String date, int page, int rows) {
+    public IPage<CouponCollectionVo> couponCollection(String date, int page, int rows,String userId) {
         IPage<CouponCollectionVo> iPage = new IPage();
-        List<CouponCollectionVo> hotelCouponList = hotelCouponDao.couponCollection(date, page, rows);
+        List<CouponCollectionVo> hotelCouponList = hotelCouponDao.couponCollection(date, page, rows,userId);
         if (hotelCouponList!=null&&hotelCouponList.size()>0) {
             for (CouponCollectionVo couponCollectionVo : hotelCouponList) {
                 if (couponCollectionVo != null) {