liu 2 gadi atpakaļ
vecāks
revīzija
835b10247b

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

@@ -639,7 +639,7 @@ public class BookingCommentImplDao implements BookingCommentDao {
                 "\tb.house_name AS houseName ,\n" +
                 "\tb.live_time as liveTime,\n" +
                 "\tb.check_out_time as checkOutTime,\n" +
-                "\tb.pay_account as payAccount,u.user_name as name,u.head_photo as headPhoto , fi4.url as houseUrl\n" +
+                "\tb.pay_account as payAccount,u.user_name as name,u.head_photo as headPhoto , fi4.url as houseUrl ,b.id as bookingId  \n" +
                 "FROM\n" +
                 "\t`booking_comment` bc\n" +
                 "\tLEFT JOIN ( SELECT fi.link_id, GROUP_CONCAT( fi.url ) AS url FROM file_info fi GROUP BY fi.link_id ) fi2 ON fi2.link_id = bc.id\n" +

+ 17 - 4
mhotel/src/com/happy/dao/impl/HotelCouponImplDao.java

@@ -309,12 +309,25 @@ public class HotelCouponImplDao implements HotelCouponDao {
                 "\thc.deduction_price as deductionPrice,\n" +
                 "\thc.max_deduction as maxDeduction,\n" +
                 "\thc.meet_price as meetPrice,\n" +
-                "\thc.effective_end_date as effectiveEndDate ,\n" +
-                "\tcount(hcs.complaint_id) AS count\n" +
+                "\thc.effective_end_date as effectiveEndDate ,hc.effective_start_date as effectiveStartDate, hc.effective_day as effectiveDay,hc.effective_lose_day as effectiveLoseDay , hc.effective_type as effectiveType, hcs.create_date as dateTime , \n" +
+                "\thcs2.count AS count\n" +
                 "FROM\n" +
                 "\thotel_coupon_status hcs\n" +
-                "\tLEFT JOIN hotel_coupon hc ON hc.id = hcs.complaint_id where FIND_IN_SET(hc.type,:status) and hcs.user_id=:userId and hcs.status=1 \n" +
-                "\tGROUP BY hcs.complaint_id ORDER BY hc.effective_start_date DESC limit :start,:rows";
+                "\tLEFT JOIN hotel_coupon hc ON hc.id = hcs.complaint_id  LEFT JOIN (\n" +
+                "SELECT\n" +
+                "\thc2.id AS id,\n" +
+                "\tcount( hcs.complaint_id ) AS count \n" +
+                "FROM\n" +
+                "\thotel_coupon_status hcs\n" +
+                "\tLEFT JOIN hotel_coupon hc2 ON hc2.id = hcs.complaint_id \n" +
+                "WHERE\n" +
+                "\tFIND_IN_SET( hc2.type, :status ) \n" +
+                "\tAND hcs.user_id = :userId \n" +
+                "\tAND hcs.`status` = 1 \n" +
+                "GROUP BY\n" +
+                "\thcs.complaint_id \n" +
+                "\t) hcs2 ON hcs2.id = hc.id  where FIND_IN_SET(hc.type,:status) and hcs.user_id=:userId and hcs.status=1  \n" +
+                "\tORDER BY hc.effective_start_date DESC limit :start,:rows";
 
         MapSqlParameterSource sps = new MapSqlParameterSource();
         sps.addValue("status", types);

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

@@ -12,10 +12,13 @@ import com.happy.service.BookService;
 import com.happy.service.HotelCoupomService;
 import com.happy.service.HotelCoupomStatusService;
 import com.happy.vo.*;
+import org.apache.commons.lang.ObjectUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -210,6 +213,29 @@ public class HotelCoupomImplService implements HotelCoupomService {
     public IPage<CardCouponPageVo> cardCouponPage(String types, String userId, int page, int rows) {
         IPage<CardCouponPageVo> iPage = new IPage();
         List<CardCouponPageVo> hotelCouponList = hotelCouponDao.cardCouponPage(types, userId, page, rows);
+        if (hotelCouponList!=null && hotelCouponList.size()>0) {
+            for (CardCouponPageVo cardCouponPageVo : hotelCouponList) {
+                Integer effectiveType = cardCouponPageVo.getEffectiveType();
+                if (2==effectiveType) {
+                    //生效天数
+                    Integer effectiveDay = cardCouponPageVo.getEffectiveDay();
+                    //失效时间天数
+                    Integer effectiveLoseDay = cardCouponPageVo.getEffectiveLoseDay();
+                    //领券时间
+                    String dateTime = cardCouponPageVo.getDateTime();
+                    DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+                    String substring = dateTime.substring(0, 19);
+                    LocalDateTime parse = LocalDateTime.parse(substring, dateTimeFormatter);
+//                    开始时间
+                    LocalDateTime localDateTime = parse.plusDays(effectiveDay);
+                    cardCouponPageVo.setEffectiveStartDate(localDateTime.format(dateTimeFormatter));
+//                    结束时间
+                    LocalDateTime localDateTime1 = localDateTime.plusDays(effectiveLoseDay);
+                    cardCouponPageVo.setEffectiveEndDate(localDateTime1.format(dateTimeFormatter));
+                }
+            }
+        }
+
         int total = hotelCouponDao.cardCouponPageTotal(types, userId);
         iPage.setPageList(hotelCouponList);
         iPage.setPage(page);

+ 9 - 0
mhotel/src/com/happy/vo/CardCouponPageVo.java

@@ -25,4 +25,13 @@ public class CardCouponPageVo {
 //    领取张数
     private Integer count;
 
+    private String effectiveStartDate;//有效期开始时间
+
+    private Integer effectiveType;//有效期类型(1.时间段 2.生效失效天数)
+
+    private Integer effectiveDay;//生效时间天数
+    private Integer effectiveLoseDay;//失效时间天数
+
+    private String dateTime;//领券时间
+
 }

+ 11 - 0
mhotel/src/com/happy/vo/PersonageDetailsVo.java

@@ -45,6 +45,17 @@ public class PersonageDetailsVo {
 
     private List<String> houseUrl;
 
+    //¶©µ¥id
+    private String bookingId;
+
+    public String getBookingId() {
+        return bookingId;
+    }
+
+    public void setBookingId(String bookingId) {
+        this.bookingId = bookingId;
+    }
+
     public String getName() {
         return name;
     }