|
|
@@ -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);
|